# set

```lua
 function test() 
    wait(3);
    
    local myValue = get('testValue'); --gets the global object/variable testValue from the main script
    
    log(myValue); --prints 10

    myValue = myValue + 15; --adds 15 to the local variable
    
    set('testValue', myValue) --sets the main script variable to the local variable here. **25**
end
return function()

    testValue = 10;
    
    local coroutineId = async('test');
    
    waitForCoroutine(coroutineId);
    --while waiting the async coroutine is playing it will print
    --10
    
    log(testValue); --prints 25
    log('finished');
end
```


---

# 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/set.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.
