NamecallFilter.new
NamecallFilter.new creates a filter that checks the active namecall method.
Syntax
NamecallFilter.new(namecall_method: string) -> NamecallFilter
Parameters
| Parameter | Type | Description |
|---|---|---|
namecall_method | string | Namecall method that must be active for a match. |
Returns
| Type | Description |
|---|---|
NamecallFilter | A filter that matches when the active namecall method equals the stored name. |
Description
NamecallFilter.new compares the namecall method recorded on the active Luau state with the stored string. It only matches while the routed call originates from a namecall, such as obj:Method().
Normal function calls do not carry a namecall method, so the filter never matches them. The comparison is case sensitive.
Example
local httpGetOnly = NamecallFilter.new("HttpGet")
local original = hookfunction(game.HttpGet, function(self, url)
return "blocked"
end, httpGetOnly)
Notes
- hookfunction accepts a filter as an optional third argument; getfilter accepts one directly.
- Only meaningful for calls made through a namecall.
- The method name must match exactly.