Working on some new features
This commit is contained in:
parent
927e45db77
commit
ec8c8c7074
@ -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'
|
||||||
|
|||||||
9
test.lua
9
test.lua
@ -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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user