> For the complete documentation index, see [llms.txt](https://docs.streamavatars.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/helper-class/split.md).

# split

```lua
function yourEvent(user, string_message)

    local words = helper.split(string_message, ' '); 
    --this is extremely helpful for bots that are trying to read commands!
    --split the message on spaces to get words in an array
    
    --check the first word
    if words[1] ~= '!yourCommand' then --in LUA... arrays start at index 1, not 0!
        
        --if word[1] is not equal to your command, exit.
        yieldBreak();
    end
    
    if words[2] == 'start' then
        log('the user has typed: !yourCommand start');
    end
end

return function()
    addEvent('chatMessage', 'yourEvent'); --attaches the event to yourEvent()
    keepAlive();
end
```
