natiny.script.make_table

Lua
natiny.script.make_table(script) -> reference

Makes an empty table in another script and returns a reference to it - the table itself, not a copy.

Parameters

Name Type Description
script number The script to make the table in

Returns

Type Description
reference The new table

Example

Lua
local state = natiny.script.make_table(mod)
natiny.script.table_set(mod, state, "wind", 0.2)
natiny.script.set(mod, "weather", state)

natiny.backend.loop(function(dt)
    -- The mod reads weather.wind and sees every change.
    natiny.script.table_set(mod, state, "wind", current_wind())
end)