ReferenceMetatables

setnamecallmethod

Changes the method name the current __namecall will use.

Syntax

setnamecallmethod(method: string) -> ()

Also available as

set_namecall_method

Parameters

ParameterTypeDescription
methodstringThe method name the next __namecall should see.

Description

Inside a __namecall hook, setting a different name before calling the original makes the engine run that method instead. Outside a hook, it sets the name a following direct call to the __namecall function will read.

Example

local old
old = hookmetamethod(game, "__namecall", function(self, ...)
    if getnamecallmethod() == "Destroy" and self.Name == "Keep" then
        setnamecallmethod("GetFullName")
    end
    return old(self, ...)
end)

These are Game executor contracts. Check build requirements and session lifetimes before using them.