# Global Functions

- [log](https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/global-functions/log.md): API - prints a message to console log
- [wait](https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/global-functions/wait.md): API - pauses the script for x amount of seconds. (essentially a timer)
- [yield](https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/global-functions/yield.md): API - pauses the script for x amount of seconds.
- [yieldBreak](https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/global-functions/yieldbreak.md): API - pauses the script for x amount of seconds.
- [async functions](https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/global-functions/async-functions.md): API - pauses the script for x amount of seconds.
- [waitForAsync function](https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/global-functions/waitforasync-function.md): API - pauses the script for x amount of seconds.
- [stopAsync function](https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/global-functions/stopasync-function.md): API - pauses the script for x amount of seconds.
- [get](https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/global-functions/get.md): API - gets global variables from the main coroutine.
- [set](https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/global-functions/set.md): API - sets global variables to the main coroutine.
- [applyImage](https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/global-functions/applyimage.md): API - applies an image or animation to a GameObject.
- [waitForAnimation](https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/global-functions/waitforanimation.md): API - pauses script until an image is finished animating
- [webrequest get/post](https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/global-functions/webrequest-get-post.md): API -
- [getUser](https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/global-functions/getuser.md): API - gets an active User by displayName or ID
- [getUsers](https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/global-functions/getusers.md): API - gets all active users in an array.
- [getUserById](https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/global-functions/getuserbyid.md): API - gets a User by id
- [getCurrency](https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/global-functions/getcurrency.md): API - gets the target User's currency value
- [addCurrency](https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/global-functions/addcurrency.md): API - add currency to a target user
- [removeCurrency](https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/global-functions/removecurrency.md): API - remove currency to a target user
- [adjustCurrency](https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/global-functions/adjustcurrency.md): API - adjust currency of a target user (sets their currency to specified a amount)
- [getBackground](https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/global-functions/getbackground.md): API - gets the title of the current background level
- [getScriptableBlocks](https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/global-functions/getscriptableblocks.md): API - gets all of the scriptable blocks on the current background level
- [getAvatar](https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/global-functions/getavatar.md): API - gets a specific avatar
- [getAllAvatars](https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/global-functions/getallavatars.md): API - gets all available avatars
- [runCommand](https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/global-functions/runcommand.md): API - sends a message to the application to run a specific command
- [writeChat](https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/global-functions/writechat.md): API - sends a message to your live stream chatroom
- [setProperty](https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/global-functions/setproperty.md): API - this is just a helper function to set a default value, but if a value already exists it will do nothing.
- [getApp](https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/global-functions/getapp.md): API - returns the App class which gives access to a group of functions and properties related to SA application.
- [save](https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/global-functions/save.md): API - saves the global variable: data on the main coroutine. This data can be found as a .JSON file in the script's folder.
- [load](https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/global-functions/load.md): API - Loads the .JSON file from the script folder. This can be used to have data persist between streaming sessions, or to just store script settings in a single location.
- [addEvent](https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/global-functions/addevent.md): API - subscribe to an event to receive data and a trigger of when certain situations occur
- [removeEvent](https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/global-functions/removeevent.md): API - unsubscribe to an event that you previously subscribed to.
- [keepAlive](https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/global-functions/keepalive.md): 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/global-functions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
