API - Keep the script alive by pausing it. This allows for other coroutines to be processed while the main script doesn't really do much.

--note this specific event has 2 parameters
function yourFunctionName(user, string_message)
    log(user.displayName .. ' has said ' .. string_message);
return function()
    --attaches the event to yourFunctionName()
    addEvent('chatMessage', 'yourFunctionName'); 
    --make sure this script is kept alive so the event can be processed!
    --nothing below keepAlive() will ever be reached.

keepAlive(); is often used with scripts that are set to Run as "On Connect" and scripts that subscribe to specific events.


Last updated