Skip to main content

PlayerMockReflectionUtils

What the engine's own reflection says about a class's events and properties, cached per class -- reflection is far too expensive to walk on every signal or property read, and these sit on the path production takes to connect an input event.

Functions

getEventNames

PlayerMockReflectionUtils.getEventNames(classNamestring) → {[string]boolean}?

Returns the set of event names reflection reports on the class, own and inherited alike, or nil when there is no such class.

isClassEvent

PlayerMockReflectionUtils.isClassEvent(
classNamestring,
eventNamestring
) → boolean

Returns whether the class exists and really has that event.

getPropertyNames

PlayerMockReflectionUtils.getPropertyNames(classNamestring) → {[string]boolean}?

Returns the set of property names reflection reports on the class, own and inherited alike, or nil when there is no such class. Methods are not properties, so a zero-arg getter like Player:HasAppearanceLoaded() is absent.

getMethodNames

PlayerMockReflectionUtils.getMethodNames(classNamestring) → {[string]boolean}?

Returns the set of method names reflection reports on the class, own and inherited alike, or nil when there is no such class.

isClassMethod

PlayerMockReflectionUtils.isClassMethod(
classNamestring,
methodNamestring
) → boolean

Returns whether the class exists and really has that method.

isClass

PlayerMockReflectionUtils.isClass(classNamestring) → boolean

Returns whether the engine reflects a class by that name at all. Every class inherits Instance's own properties, so a real one always reflects some.

isService

PlayerMockReflectionUtils.isService(classNamestring) → boolean

Returns whether the class names a service -- one of the singletons game:GetService hands out, rather than an instance class anything can hold. True whether or not the service has been instantiated in this DataModel.

isClassProperty

PlayerMockReflectionUtils.isClassProperty(
classNamestring,
propertyNamestring
) → boolean

Returns whether the class exists and really has that property.

findNativeSignal

PlayerMockReflectionUtils.findNativeSignal(
instanceInstance,
eventNamestring
) → RBXScriptSignal?

Returns the genuine signal for events an instance inherits natively (AncestryChanged, Destroying, ...), or nil when it exposes no such member. Only the rest need a stand-in.

Show raw api
{
    "functions": [
        {
            "name": "getEventNames",
            "desc": "Returns the set of event names reflection reports on the class, own and inherited alike, or nil\nwhen there is no such class.",
            "params": [
                {
                    "name": "className",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [string]: boolean }?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 26,
                "path": "src/player-mock/src/Shared/Helpers/Reflection/PlayerMockReflectionUtils.lua"
            }
        },
        {
            "name": "isClassEvent",
            "desc": "Returns whether the class exists and really has that event.",
            "params": [
                {
                    "name": "className",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "eventName",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 48,
                "path": "src/player-mock/src/Shared/Helpers/Reflection/PlayerMockReflectionUtils.lua"
            }
        },
        {
            "name": "getPropertyNames",
            "desc": "Returns the set of property names reflection reports on the class, own and inherited alike, or\nnil when there is no such class. Methods are not properties, so a zero-arg getter like\n`Player:HasAppearanceLoaded()` is absent.",
            "params": [
                {
                    "name": "className",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [string]: boolean }?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 62,
                "path": "src/player-mock/src/Shared/Helpers/Reflection/PlayerMockReflectionUtils.lua"
            }
        },
        {
            "name": "getMethodNames",
            "desc": "Returns the set of method names reflection reports on the class, own and inherited alike, or nil\nwhen there is no such class.",
            "params": [
                {
                    "name": "className",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [string]: boolean }?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 84,
                "path": "src/player-mock/src/Shared/Helpers/Reflection/PlayerMockReflectionUtils.lua"
            }
        },
        {
            "name": "isClassMethod",
            "desc": "Returns whether the class exists and really has that method.",
            "params": [
                {
                    "name": "className",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "methodName",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 106,
                "path": "src/player-mock/src/Shared/Helpers/Reflection/PlayerMockReflectionUtils.lua"
            }
        },
        {
            "name": "isClass",
            "desc": "Returns whether the engine reflects a class by that name at all. Every class inherits `Instance`'s\nown properties, so a real one always reflects some.",
            "params": [
                {
                    "name": "className",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 119,
                "path": "src/player-mock/src/Shared/Helpers/Reflection/PlayerMockReflectionUtils.lua"
            }
        },
        {
            "name": "isService",
            "desc": "Returns whether the class names a service -- one of the singletons `game:GetService` hands out,\nrather than an instance class anything can hold. True whether or not the service has been\ninstantiated in this DataModel.",
            "params": [
                {
                    "name": "className",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 131,
                "path": "src/player-mock/src/Shared/Helpers/Reflection/PlayerMockReflectionUtils.lua"
            }
        },
        {
            "name": "isClassProperty",
            "desc": "Returns whether the class exists and really has that property.",
            "params": [
                {
                    "name": "className",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "propertyName",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 157,
                "path": "src/player-mock/src/Shared/Helpers/Reflection/PlayerMockReflectionUtils.lua"
            }
        },
        {
            "name": "findNativeSignal",
            "desc": "Returns the genuine signal for events an instance inherits natively (`AncestryChanged`,\n`Destroying`, ...), or nil when it exposes no such member. Only the rest need a stand-in.",
            "params": [
                {
                    "name": "instance",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "eventName",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "RBXScriptSignal?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 171,
                "path": "src/player-mock/src/Shared/Helpers/Reflection/PlayerMockReflectionUtils.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "PlayerMockReflectionUtils",
    "desc": "What the engine's own reflection says about a class's events and properties, cached per class --\nreflection is far too expensive to walk on every signal or property read, and these sit on the\npath production takes to connect an input event.",
    "source": {
        "line": 9,
        "path": "src/player-mock/src/Shared/Helpers/Reflection/PlayerMockReflectionUtils.lua"
    }
}