# getGameObject

```lua
function test()
    local id = get('objectId');
    local app = getApp();
    local ob = app.getGameObject(id);
end
objectId = '';
return function()
    local app = getApp();
    local myObject = app.createGameObject(); --objects can be used for adding images
    objectId = myObject.id;
    async('test');
end
```

{% hint style="info" %}
This is how you get objects to be shared between sub coroutines.
{% endhint %}

{% content-ref url="../../global-functions/applyimage" %}
[applyimage](https://docs.streamavatars.com/lua-scripting-api/api-reference-and-tips/global-functions/applyimage)
{% endcontent-ref %}
