natiny_script_set

C
void natiny_script_set(NatinyScript script, const char* path, NatinyScriptValue value);

Puts a value under a dotted name in the script, making the tables on the way if they are not there.

Parameters

Name Type Description
script NatinyScript The state to set in
path const char* Dotted name, from the globals down; each segment may contain at most 127 bytes
value NatinyScriptValue Value to store; string bytes are copied before the function returns

Example

C
natiny_script_set(script, "game.VERSION", natiny_script_make_number(3));
natiny_script_set(script, "game.NAME", natiny_script_make_string("Sponza"));
natiny_script_set(script, "game.window", natiny_script_make_handle(window));
natiny_script_set(script, "game.step", natiny_script_make_function(script, step));
Lua
print(game.NAME, game.VERSION)
natiny.window.bind(game.window)