> 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/load.md).

# load

```lua
return function()
    --usually you call load at the top of a script.
    load(); --makes the data global variable exist with all previously stored/saved data.
    
    -- ---------------
    --note this is not needed in this example. it's just for show!
    local mdata = get('data'); --note this is only needed if you 
    -- are accessing the data from a subcoroutine!
    
    --if you want to save data from a subcoroutine, first make a copy like above
    --then use set('data', mdata);
    --then use save();
    -- ---------------
    
    if data.x == nil then
        data.x = 1;
    else 
        data.x = data.x + 1;
    end
    
    save(); --data gets saved in the json settings!
end
```
