Global Command: setDelay
From The Official Visionaire Studio: Adventure Game Engine Wiki
Executes a function with a delay.
Syntax
setDelay(time, callback)
Parameters
Parameter | Type | Description |
---|---|---|
time | integer | Time to wait until the callback function gets executed (in milliseconds). |
callback | function/string | Callback function to execute. |
Return values
none
Examples
Example 1: Different ways of printing "Hello World" with a delay of 1 second.
function helloWorld()
print("Hello World")
end
-- Call the "helloWorld()" function
setDelay(1000, "helloWorld()")
-- Another way to call the "helloWorld()" function
setDelay(1000, helloWorld)
-- Use an anonymous function as the second argument
setDelay(1000, function() print("Hello World") end)