mirror of
https://github.com/vxcontrol/lualibs-winapi.git
synced 2026-07-01 13:54:03 -04:00
27 lines
465 B
Lua
27 lines
465 B
Lua
require 'winapi'
|
|
io.stdout:setvbuf 'no'
|
|
local t1,t2
|
|
t1 = winapi.make_timer(500,function()
|
|
print 'gotcha'
|
|
end)
|
|
|
|
local k = 1
|
|
t2 = winapi.make_timer(400,function()
|
|
k = k + 1
|
|
print(k)
|
|
if k > 5 then
|
|
print 'killing'
|
|
t1:kill() -- kill the first timer
|
|
t2 = nil
|
|
return true -- and we will end now
|
|
end
|
|
end)
|
|
|
|
winapi.make_timer(1000,function()
|
|
print 'doo'
|
|
if not t2 then os.exit(0) end -- we all finish
|
|
end)
|
|
|
|
-- sleep forever...
|
|
winapi.sleep(-1)
|