For the complete documentation index, see llms.txt. This page is also available as Markdown.

API Reference & Tips

API - Reminders, Helpful tips, and things you should know before starting.

Do's and Don'ts

function anotherFunction()
    --see how this function is above the return function()?
    
    --the double dash is how we make line comments in lua scripting
    
    --[[
        this is how we make block comments in lua scripting.
        multiple lines. woooo
    ]]
    
    log('hello world');
end

return function()
    anotherFunction();
    --this should be the last function of your script! 
end --Don't put anything below the last end
return function()
    local test = 'hi';
    local test2 = false;
    
    if test2 == false and test == 'hi' then
        log('&& operators is just and');
    else if test2 == true or test == 'bye' then
        log('|| operators is just or');
    end
    
    if test2 == false then
        log('simple if');
    end
    
    if test2 == false then
        log('simple if else');
    else
        log('blah');
    end
end

coroutines are unique in SA Lua. They allow for scripts to wait for something to finish before continuing. Do not cross global variables between coroutines! This can be tricky to use but is very powerful for scripting sequences of events.

Pre-existing Functions and Data

With LUA scripting in stream avatars, there are some addons your your script behind the scenes that you should know about!

User
example !steal settings

Last updated