> 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/global-functions/async-functions.md).

# async functions

```lua
function test() 
    wait(3);
    log('async function completed!');
end
return function()

    for i=0,3,1 do
        async('test');
    end
    log('hello world');
    
    wait(3.1); --Wait just long enough for all coroutines to finish
    
    --it will print async function completed before finished!
    log('finished!')
end
```
