natiny.script.call
Lua
natiny.script.call(script, path, ...) -> ok, ...
Calls the function under a dotted name in another script.
Parameters
| Name |
Type |
Description |
script |
number |
The script to call in |
path |
string |
Dotted name of the function |
... |
any |
Arguments, at most natiny.script.MAX_ARGS of them |
Returns
| Type |
Description |
boolean |
true and then up to natiny.script.MAX_RESULTS values returned by the function; false and the message when the name is missing, does not hold a function, or the call raised |
Example
Lua
local ok, saved, slot = natiny.script.call(mod, "on_save", "autosave", 3)
if not ok then
print("mod on_save failed: " .. saved) -- the message is second
elseif saved then
print("saved to slot " .. slot)
end