Working on some new features

This commit is contained in:
Ryan Ward 2020-02-08 08:50:44 -05:00
parent 927e45db77
commit ec8c8c7074
2 changed files with 12 additions and 0 deletions

View File

@ -1220,6 +1220,9 @@ function multi:newTLoop(func,set)
self:create(c) self:create(c)
return c return c
end end
function multi:setTimeout(func,t)
multi:newThread(function() thread.sleep(t) func() end)
end
function multi:newTrigger(func) function multi:newTrigger(func)
local c={} local c={}
c.Type='trigger' c.Type='trigger'

View File

@ -3,6 +3,9 @@ multi,thread = require("multi"):init()
multi.OnLoad(function() multi.OnLoad(function()
print("Code Loaded!") print("Code Loaded!")
end) end)
multi:setTimeout(function()
print("here we are!")
end,2)
local t local t
co = 0 co = 0
multi.OnExit(function(n) multi.OnExit(function(n)
@ -12,6 +15,12 @@ test = thread:newFunction(function()
thread.sleep(1) thread.sleep(1)
return 1,math.random(2,100) return 1,math.random(2,100)
end) end)
multi:newThread(function()
while true do
thread.sleep(.1)
print("!")
end
end)
multi:newThread(function() multi:newThread(function()
t = os.clock() t = os.clock()
while true do while true do