Skip to main content

InputKeyMapList

An input key map list provides a mapping of input modes to input keys. One of these should generally exist per an action with unique bindings.

All inputs should be bound while this action is active. We can further query inputs per an input mode to display only relevant key bindings to the user.

local inputKeyMapList = InputKeyMapList.new("BOOST", {
	InputKeyMap.new(InputModeTypes.KeyboardAndMouse, { Enum.KeyCode.LeftControl });
	InputKeyMap.new(InputModeTypes.Gamepads, { Enum.KeyCode.ButtonX });
	InputKeyMap.new(InputModeTypes.Touch, { SlottedTouchButtonUtils.createSlottedTouchButton("primary1") });
})

maid:GiveTask(Rx.combineLatest({
	isRobloxTouchButton = inputKeyMapList:ObserveIsRobloxTouchButton();
	inputEnumsList = inputKeyMapList:ObserveInputEnumsList();
}):Subscribe(function(state)
	maid._contextMaid = nil

	local contextMaid = Maid.new()

	ContextActionService:BindActionAtPriority(
		"MyAction",
		function(_actionName, userInputState, inputObject)
			print("Process input", inputObject)
		end,
		state.isRobloxTouchButton,
		Enum.ContextActionPriority.High.Value,
		unpack(state.inputEnumsList))

		maid._contextMaid = contextMaid
	end))
end))

Functions​

new​

InputKeyMapList.new(
inputMapName: string,
inputKeyMapList: {InputKeyMap},
options: {
bindingName: string,
rebindable: boolean
}--

configuration options

) → InputKeyMapList

Constructs a new InputKeyMapList

isInputKeyMapList​

InputKeyMapList.isInputKeyMapList(value: any) → boolean

Returns whether this value is an InputKeyMapList

IsUserRebindable​

InputKeyMapList:IsUserRebindable() → boolean

Returns user bindable time

GetBindingName​

InputKeyMapList:GetBindingName() → string

Gets the english name

Add​

InputKeyMapList:Add(inputKeyMap: InputKeyMap) → ()

Adds an input key map into the actual list

GetListName​

InputKeyMapList:GetListName() → string

Gets the list name and returns it. Used by an input key map provider

ObservePairsBrio​

InputKeyMapList:ObservePairsBrio() → Observable<Brio<InputModeType,InputKeyMap>>

Observes a brio with the first value as the InputModeType and the second value as the KeyMapList

RestoreDefault​

InputKeyMapList:RestoreDefault() → ()

Restores the default value for all lists

RemoveInputModeType​

InputKeyMapList:RemoveInputModeType(inputModeType: InputModeType) → ()

Removes the entry for the inputmodeType

ObserveInputKeyMapsBrio​

InputKeyMapList:ObserveInputKeyMapsBrio() → Observable<Brio<InputKeyMap>>

ObserveInputModesTypesBrio​

InputKeyMapList:ObserveInputModesTypesBrio() → Observable<Brio<InputModeType>>

ObserveInputKeyMapForInputMode​

InputKeyMapList:ObserveInputKeyMapForInputMode(inputModeType: InputModeType) → Observable<InputKeyMap>

Observes the input types for the active input map

ObserveIsTapInWorld​

InputKeyMapList:ObserveIsTapInWorld() → Observable<boolean>

Observes whether the input list includes tapping in the world somewhere.

ObserveIsRobloxTouchButton​

InputKeyMapList:ObserveIsRobloxTouchButton() → Observable<boolean>

Observes whether the input list includes a Roblox button.

IsRobloxTouchButton​

InputKeyMapList:IsRobloxTouchButton() → boolean

Gets whether the input list includes a Roblox button.

IsTouchTapInWorld​

InputKeyMapList:IsTouchTapInWorld() → boolean

Gets whether the input list includes a Roblox button.

ObserveInputEnumsList​

InputKeyMapList:ObserveInputEnumsList() → Observable<{UserInputType | KeyCode}>

Observes the input enums list, which can be used for bindings.

ObserveInputEnumsSet​

InputKeyMapList:ObserveInputEnumsSet() → Observable<{[UserInputType | KeyCode]: true}>

Observes the input enums set

ObserveSlottedTouchButtonDataBrio​

InputKeyMapList:ObserveSlottedTouchButtonDataBrio() → Observable<SlottedTouchButton>

Observes slotted touch button data in the input modes.

Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Constructs a new InputKeyMapList",
            "params": [
                {
                    "name": "inputMapName",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "inputKeyMapList",
                    "desc": "",
                    "lua_type": "{ InputKeyMap }"
                },
                {
                    "name": "options",
                    "desc": "configuration options",
                    "lua_type": "{ bindingName: string, rebindable: boolean }"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "InputKeyMapList"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 70,
                "path": "src/inputkeymaputils/src/Shared/InputKeyMapList.lua"
            }
        },
        {
            "name": "isInputKeyMapList",
            "desc": "Returns whether this value is an InputKeyMapList",
            "params": [
                {
                    "name": "value",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 92,
                "path": "src/inputkeymaputils/src/Shared/InputKeyMapList.lua"
            }
        },
        {
            "name": "IsUserRebindable",
            "desc": "Returns user bindable time",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 100,
                "path": "src/inputkeymaputils/src/Shared/InputKeyMapList.lua"
            }
        },
        {
            "name": "GetBindingName",
            "desc": "Gets the english name",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 108,
                "path": "src/inputkeymaputils/src/Shared/InputKeyMapList.lua"
            }
        },
        {
            "name": "Add",
            "desc": "Adds an input key map into the actual list",
            "params": [
                {
                    "name": "inputKeyMap",
                    "desc": "",
                    "lua_type": "InputKeyMap"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 120,
                "path": "src/inputkeymaputils/src/Shared/InputKeyMapList.lua"
            }
        },
        {
            "name": "GetListName",
            "desc": "Gets the list name and returns it. Used by an input key map provider",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 131,
                "path": "src/inputkeymaputils/src/Shared/InputKeyMapList.lua"
            }
        },
        {
            "name": "ObservePairsBrio",
            "desc": "Observes a brio with the first value as the InputModeType and the second value as the KeyMapList",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<Brio<InputModeType, InputKeyMap>>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 191,
                "path": "src/inputkeymaputils/src/Shared/InputKeyMapList.lua"
            }
        },
        {
            "name": "RestoreDefault",
            "desc": "Restores the default value for all lists",
            "params": [],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 198,
                "path": "src/inputkeymaputils/src/Shared/InputKeyMapList.lua"
            }
        },
        {
            "name": "RemoveInputModeType",
            "desc": "Removes the entry for the inputmodeType",
            "params": [
                {
                    "name": "inputModeType",
                    "desc": "",
                    "lua_type": "InputModeType"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 209,
                "path": "src/inputkeymaputils/src/Shared/InputKeyMapList.lua"
            }
        },
        {
            "name": "ObserveInputKeyMapsBrio",
            "desc": "",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<Brio<InputKeyMap>>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 218,
                "path": "src/inputkeymaputils/src/Shared/InputKeyMapList.lua"
            }
        },
        {
            "name": "ObserveInputModesTypesBrio",
            "desc": "",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<Brio<InputModeType>>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 225,
                "path": "src/inputkeymaputils/src/Shared/InputKeyMapList.lua"
            }
        },
        {
            "name": "ObserveInputKeyMapForInputMode",
            "desc": "Observes the input types for the active input map",
            "params": [
                {
                    "name": "inputModeType",
                    "desc": "",
                    "lua_type": "InputModeType"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<InputKeyMap>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 235,
                "path": "src/inputkeymaputils/src/Shared/InputKeyMapList.lua"
            }
        },
        {
            "name": "ObserveIsTapInWorld",
            "desc": "Observes whether the input list includes tapping in the world somewhere.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<boolean>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 246,
                "path": "src/inputkeymaputils/src/Shared/InputKeyMapList.lua"
            }
        },
        {
            "name": "ObserveIsRobloxTouchButton",
            "desc": "Observes whether the input list includes a Roblox button.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<boolean>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 257,
                "path": "src/inputkeymaputils/src/Shared/InputKeyMapList.lua"
            }
        },
        {
            "name": "IsRobloxTouchButton",
            "desc": "Gets whether the input list includes a Roblox button.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 268,
                "path": "src/inputkeymaputils/src/Shared/InputKeyMapList.lua"
            }
        },
        {
            "name": "IsTouchTapInWorld",
            "desc": "Gets whether the input list includes a Roblox button.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 279,
                "path": "src/inputkeymaputils/src/Shared/InputKeyMapList.lua"
            }
        },
        {
            "name": "ObserveInputEnumsList",
            "desc": "Observes the input enums list, which can be used for bindings.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<{UserInputType | KeyCode}>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 290,
                "path": "src/inputkeymaputils/src/Shared/InputKeyMapList.lua"
            }
        },
        {
            "name": "ObserveInputEnumsSet",
            "desc": "Observes the input enums set",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<{[UserInputType | KeyCode]: true }>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 301,
                "path": "src/inputkeymaputils/src/Shared/InputKeyMapList.lua"
            }
        },
        {
            "name": "ObserveSlottedTouchButtonDataBrio",
            "desc": "Observes slotted touch button data in the input modes.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<SlottedTouchButton>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 312,
                "path": "src/inputkeymaputils/src/Shared/InputKeyMapList.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "InputKeyMapList",
    "desc": "An input key map list provides a mapping of input modes to input keys.\nOne of these should generally exist per an action with unique bindings.\n\nAll inputs should be bound while this action is active. We can further\nquery inputs per an input mode to display only relevant key bindings to\nthe user.\n\n```lua\nlocal inputKeyMapList = InputKeyMapList.new(\"BOOST\", {\n\tInputKeyMap.new(InputModeTypes.KeyboardAndMouse, { Enum.KeyCode.LeftControl });\n\tInputKeyMap.new(InputModeTypes.Gamepads, { Enum.KeyCode.ButtonX });\n\tInputKeyMap.new(InputModeTypes.Touch, { SlottedTouchButtonUtils.createSlottedTouchButton(\"primary1\") });\n})\n\nmaid:GiveTask(Rx.combineLatest({\n\tisRobloxTouchButton = inputKeyMapList:ObserveIsRobloxTouchButton();\n\tinputEnumsList = inputKeyMapList:ObserveInputEnumsList();\n}):Subscribe(function(state)\n\tmaid._contextMaid = nil\n\n\tlocal contextMaid = Maid.new()\n\n\tContextActionService:BindActionAtPriority(\n\t\t\"MyAction\",\n\t\tfunction(_actionName, userInputState, inputObject)\n\t\t\tprint(\"Process input\", inputObject)\n\t\tend,\n\t\tstate.isRobloxTouchButton,\n\t\tEnum.ContextActionPriority.High.Value,\n\t\tunpack(state.inputEnumsList))\n\n\t\tmaid._contextMaid = contextMaid\n\tend))\nend))\n```",
    "source": {
        "line": 40,
        "path": "src/inputkeymaputils/src/Shared/InputKeyMapList.lua"
    }
}