Hey, I know Corona is event-based and whatnot. But I am making a metronome-based app so timing is very important. I'll spare you the unnecessary details, but what I need to know is how I can start a function at a specific OS time.
local function metronomeTick() print("tick") end local function startMetronome() started = true repeat timer.performWithDelay(20, metronomeTick)--This Line until os.time() == startTime repeat timer.performWithDelay(60/tempo, metronomeTick) local stopData = send:receive() until stopData and stopData == "Stop" end
The line I labelled should make it tick every 20 milliseconds until the os time reaches the variable startTime. However, the app just crashes. What should I do instead? Thanks.