natiny.script.table_set

Lua
natiny.script.table_set(script, table, key, value)

Writes a field of a table by name.

Parameters

Name Type Description
script number The script the table lives in
table reference The table to write, from make_table
key string Field name
value any What to store - see script values

Example

Lua
local hooks = natiny.script.make_table(mod)

natiny.script.table_set(mod, hooks, "version", 3)
natiny.script.table_set(mod, hooks, "on_tick", function(dt) advance(dt) end)
natiny.script.set(mod, "host.hooks", hooks)