natiny.script.make_function
Lua
natiny.script.make_function(script, fn) -> reference
Makes a function in another script that calls fn here, and returns a
reference to it.
Parameters
| Name |
Type |
Description |
script |
number |
The script the function is made in |
fn |
function |
The function of this script it calls |
Returns
| Type |
Description |
reference |
The function over there |
Example
Lua
local hooks = natiny.script.make_table(mod)
natiny.script.table_set(mod, hooks, "on_hit",
natiny.script.make_function(mod, function(damage)
health = health - damage
end))
natiny.script.set(mod, "host.hooks", hooks)