I referred to the official demo, but the expected output seems different from what I imagined. Did I misunderstand something? My operating system is Windows 10.
Version: LuaRT 1.8.0 x64 - Windows programming framework for Lua.
test code:
function hello(msg)
sleep(1000)
print("Hello "..msg.." !")
n = n+1
if n < 4 then
sys.Task(hello)("from task #"..n)
end
end
task = sys.Task(hello)
-- Keeps track of current number of Tasks
n = 1
task("from task #"..n)
-- Wait for all Tasks to terminate
waitall()
The actual output is:
Hello from task #1 !
The expected output is:
Hello from task #1 !
Hello from task #2 !
Hello from task #3 !