getnamecallmethod
Returns the name of the method being called through __namecall.
Syntax
getnamecallmethod() -> string?
Also available as
get_namecall_method
Returns
| Type | Description |
|---|---|
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
- Read it at the start of the hook. Any other namecall made before you read it, including one inside a
print, replaces the stored name.
These are Game executor contracts. Check build requirements and session lifetimes before using them.
