natiny.script.set
natiny.script.set(script, path, value)
Puts a value under a dotted name in another script, making the tables on the way if they are not there.
Parameters
| Name | Type | Description |
|---|---|---|
script |
number |
The script to set in |
path |
string |
Dotted name, from that script's globals down; each segment at most 127 bytes |
value |
any |
What to store - see script values |
Example
natiny.script.set(mod, "game.VERSION", 3)
natiny.script.set(mod, "game.NAME", "Sponza")
natiny.script.set(mod, "game.window", natiny.script.make_handle(window))
natiny.script.set(mod, "game.config", { width = 1280, height = 720 })
-- in the mod
print(game.NAME, game.VERSION, game.config.width)
natiny.window.bind(game.window)