modified test file

This commit is contained in:
Ryan Ward 2020-01-30 14:39:09 -05:00
parent 2521a90712
commit 0446dd0bea

View File

@ -1,16 +1,17 @@
package.path="?/init.lua;?.lua;"..package.path
multi,thread = require("multi"):init()
function test() -- Auto converts your function into a threaded function
test = thread:newFunction(function()
thread.sleep(1)
return 1,2
end
end)
multi:newThread(function()
while true do
thread.sleep(.1)
print("hi")
end
end)
c,d = test()
-- When not in a threaded enviroment at root level we need to tell the code that we are waiting!
c,d = test().wait()
print(c,d)
a,b = 6,7
multi:newThread(function()
@ -26,4 +27,7 @@ multi:newThread(function()
end)
-- This waits for the returns since we are demanding them
end)
multi.OnExit(function(n)
print("Code Exited")
end)
multi:mainloop()