natiny.script.table_get_item
Lua
natiny.script.table_get_item(script, table, index) -> value
Reads a numbered entry of a table.
Parameters
| Name |
Type |
Description |
script |
number |
The script the table lives in |
table |
reference |
The table to read, from make_table |
index |
number |
Position, counted from 1 as Lua counts; negative is an error |
Returns
| Type |
Description |
any |
What is there, or nil |
Example
Lua
-- `list` is a reference from make_table, given to the mod earlier.
for i = 1, natiny.script.table_get_length(mod, list) do
local name = natiny.script.table_get_item(mod, list, i)
if name then load_mod(name) end
end