I have tried the two examples from the tutorial ‘Asynchronous programming : async/await functions’ and they do not work as described.
function hello(delay, msg)
sleep(delay)
print(msg)
end
-- spawn the first asynchrounous Task (prints "Hello" after 1sec)
-- then, once its terminated, make another async call, and set the Task.after property to print the "done" message
async(hello, 1000, "Hello").after = function()
async(hello, 1000, "World").after = function()
print("done")
end
end
waitall()
function hello(delay, msg)
sleep(delay)
print(msg)
end
-- spawn the first asynchrounous Task (prints "Hello" after 1sec)
-- then, once its terminated, make another async call, and set the Task.after property to print the "done" message
async(hello, 1000, "Hello").after = function()
await(hello, 1000, "World")
print("done")
end
waitall()
Can you check those two examples?