This function allows RBXMods to set which function is used to handle calls to the RBXMod. This function should accept call arguments passed to the RBXMod and its return values are passed back to the caller. Calls are only handled when the RBXMod calls Yield(). Arguments to the RBXMod and values returned by the handler are passed over the network to and from the caller in JSON format. Only nil, numbers, booleans, strings, and non-circular tables can be encoded in JSON.

Definition

void SetHandler (callback handler)

Arguments

  • callback handler This lua function takes the call arguments and its returns values are returned to the caller.

Returns

No return values.

Example

local function echo(...)
    return "Hello, Caller! I received:", ...
end

RBXMod.SetHandler(echo)

while true do
    RBXMod.Yield()
end