ReferenceMetatables

getnamecallmethod

Returns the name of the method being called through __namecall.

Syntax

getnamecallmethod() -> string?

Also available as

get_namecall_method

Returns

TypeDescription
string?The method name of the namecall in progress, or nil outside one.

Description

A call written as object:Method(...) on an Instance goes to the shared __namecall metamethod with the method name stored aside. Inside a __namecall hook, this function returns that name, such as "FindFirstChild" or "FireServer".

Example

local old
old = hookmetamethod(game, "__namecall", function(self, ...)
    local method = getnamecallmethod()
    if method == "FireServer" and self.Name == "Chat" then
        print("chat", ...)
    end
    return old(self, ...)
end)

Notes

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