Hey guys! How can I call an registered rpc function from another server script?
Example:
- RPC function declaration and register:
-- file1.lua
function get_value(_, _)
return nk.json_encode({value = 42})
end
nk.register_rpc(get_value, "get_value")
- Call function inside another file
-- file2.lua
function custom_rpc_func(context, payload)
...
local value = nk.json_decode("-- HERE someway call the function 'get_value' and get it's response --")
...
end