Capy64/Capy64/Assets/Lua/boot/03_timer.lua
Alessandro Proto 5e0183cc1c Added error checking to Lua libs,
added http_failure event to http.requestAsync
2023-01-13 23:43:01 +01:00

13 lines
No EOL
300 B
Lua

local timer = require("timer")
local expect = require("expect").expect
local range = require("expect").range
function timer.sleep(n)
expect(1, n, "number")
range(1, 1)
local timerId = timer.start(n)
repeat
local _, par = coroutine.yield("timer")
until par == timerId
end