Skip to main content

PlayerMockInputUtils

The action registry behind the context-restricted ContextActionService binds a mock stands in for. All bind domains share one registry per mock, like the engine's, so rebinding a name replaces the callback.

The binds themselves are modelled in PlayerMockMethodUtils with every other native method; this is where the callbacks they register live.

Use PlayerMock.bindInput, PlayerMock.isInputBound and PlayerMock.fireInput.

Functions

bindAction

PlayerMockInputUtils.bindAction(
playerPlayer,--

must be a PlayerMock

actionNamestring,
functionToBind(
actionNamestring,
userInputStateEnum.UserInputState,
inputObjectany
) → any
) → ()

Registers the callback an action fires, replacing whatever that name was bound to.

Reached through PlayerMock.bindInput, which routes the engine's bind domains here.

unbindAction

PlayerMockInputUtils.unbindAction(
playerPlayer,--

must be a PlayerMock

actionNamestring
) → ()

Drops the callback an action fires. Unbinding an unbound action is a no-op.

Reached through PlayerMock.bindInput, which routes the engine's unbind domain here.

isInputBound

PlayerMockInputUtils.isInputBound(
playerPlayer,--

must be a PlayerMock

actionNamestring
) → boolean

Returns whether the given action is currently bound on a mock.

Use PlayerMock.isInputBound.

fireInput

PlayerMockInputUtils.fireInput(
playerPlayer,--

must be a PlayerMock

actionNamestring,
userInputStateEnum.UserInputState,
inputObjectany?--

a real InputObject, a plain stand-in table, or a MockInputObject

) → Enum.ContextActionResult?

Errors when the action is not bound.

Use PlayerMock.fireInput.

Show raw api
{
    "functions": [
        {
            "name": "bindAction",
            "desc": "Registers the callback an action fires, replacing whatever that name was bound to.\n\nReached through [PlayerMock.bindInput], which routes the engine's bind domains here.",
            "params": [
                {
                    "name": "player",
                    "desc": "must be a PlayerMock",
                    "lua_type": "Player"
                },
                {
                    "name": "actionName",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "functionToBind",
                    "desc": "",
                    "lua_type": "(actionName: string, userInputState: Enum.UserInputState, inputObject: any) -> any"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 33,
                "path": "src/player-mock/src/Shared/Helpers/Input/PlayerMockInputUtils.lua"
            }
        },
        {
            "name": "unbindAction",
            "desc": "Drops the callback an action fires. Unbinding an unbound action is a no-op.\n\nReached through [PlayerMock.bindInput], which routes the engine's unbind domain here.",
            "params": [
                {
                    "name": "player",
                    "desc": "must be a PlayerMock",
                    "lua_type": "Player"
                },
                {
                    "name": "actionName",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 59,
                "path": "src/player-mock/src/Shared/Helpers/Input/PlayerMockInputUtils.lua"
            }
        },
        {
            "name": "isInputBound",
            "desc": "Returns whether the given action is currently bound on a mock.\n\nUse [PlayerMock.isInputBound].",
            "params": [
                {
                    "name": "player",
                    "desc": "must be a PlayerMock",
                    "lua_type": "Player"
                },
                {
                    "name": "actionName",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 78,
                "path": "src/player-mock/src/Shared/Helpers/Input/PlayerMockInputUtils.lua"
            }
        },
        {
            "name": "fireInput",
            "desc": "Errors when the action is not bound.\n\nUse [PlayerMock.fireInput].",
            "params": [
                {
                    "name": "player",
                    "desc": "must be a PlayerMock",
                    "lua_type": "Player"
                },
                {
                    "name": "actionName",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "userInputState",
                    "desc": "",
                    "lua_type": "Enum.UserInputState"
                },
                {
                    "name": "inputObject",
                    "desc": "a real InputObject, a plain stand-in table, or a [MockInputObject]",
                    "lua_type": "any?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Enum.ContextActionResult?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 96,
                "path": "src/player-mock/src/Shared/Helpers/Input/PlayerMockInputUtils.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "PlayerMockInputUtils",
    "desc": "The action registry behind the context-restricted `ContextActionService` binds a mock stands in\nfor. All bind domains share one registry per mock, like the engine's, so rebinding a name\nreplaces the callback.\n\nThe binds themselves are modelled in [PlayerMockMethodUtils] with every other native method; this\nis where the callbacks they register live.\n\nUse [PlayerMock.bindInput], [PlayerMock.isInputBound] and [PlayerMock.fireInput].",
    "source": {
        "line": 14,
        "path": "src/player-mock/src/Shared/Helpers/Input/PlayerMockInputUtils.lua"
    }
}