Asynchronous delay in Lua? (like JavaScript setTimeout)

Viewed 3231

I need to asynchronously delay execution of a function in Lua by X milliseconds. Can this be done?

Given a simple JavaScript example:

setTimeout(function() {
    alert('Hello world!');
}, 5000);

What's the Lua equivalent? Coroutines look like they may help, but I'm not sure.

2 Answers
Related