natiny.script.get
Lua
natiny.script.get(script, path) -> value
Reads the value under a dotted name in another script.
Parameters
| Name |
Type |
Description |
script |
number |
The script to read from |
path |
string |
Dotted name, from that script's globals down; an empty or overlong segment resolves as missing, and each segment may contain at most 127 bytes |
Returns
| Type |
Description |
any |
A copy of what is there, or nil when the name - or any table on the way to it - is missing |
Example
Lua
local version = natiny.script.get(mod, "MOD_VERSION")
local manifest = natiny.script.get(mod, "manifest")
if manifest then
print(manifest.name, manifest.version)
for _, need in ipairs(manifest.needs) do
print("needs " .. need)
end
end