natiny_script_make_table
C
NatinyScriptValue natiny_script_make_table(NatinyScript script);
Makes an empty table in the script and returns it as a value.
Parameters
| Name |
Type |
Description |
script |
NatinyScript |
The state to make it in |
Returns
| Type |
Description |
NatinyScriptValue |
Value tagged NATINY_SCRIPT_TABLE, or NATINY_SCRIPT_NIL when the handle names no state |
Example
C
NatinyScriptValue config = natiny_script_make_table(script);
natiny_script_table_set(script, config, "title",
natiny_script_make_string("Sponza"));
natiny_script_table_set(script, config, "width",
natiny_script_make_number(1280));
natiny_script_table_set_item(script, config, 1,
natiny_script_make_string("vulkan"));
natiny_script_set(script, "game.config", config);
Lua
print(game.config.title, game.config.width, game.config[1])
Notes
- The next call ends the loan only after its arguments are on the stack, so a
table can also be built and passed straight in as one.