Skip to main content

Axis

The Axis library used to define input axes, get devices, and update inputs

Types

DeviceType

type DeviceType = "Desktop" | "Touch" | "Controller"

Functions

input

Axis.input(keyMapMap<T>) → Input<T>

Types

type Map<T> = {[Enum | string]T} & {Enum.KeyCode | Enum.UserInputType}

Creates a new input axis with the provided keymap

local attack = Axis.input {
	Enum.KeyCode.E,
	Enum.KeyCode.ButtonX,
}

update

Axis.update() → ()

Updates all the provided inputs as a shorthand

Axis.update(inputMap) 

device

Axis.device() → ()

Gets the device of the provided UserInputType (or the last UserInputType if none is provided)

local device = Axis.device() --gets device of last input
if device == "Desktop" then
	print("yay")
end
Show raw api
{
    "functions": [
        {
            "name": "input",
            "desc": "Creates a new input axis with the provided keymap\n```lua\nlocal attack = Axis.input {\n\tEnum.KeyCode.E,\n\tEnum.KeyCode.ButtonX,\n}\n```",
            "params": [
                {
                    "name": "keyMap",
                    "desc": "",
                    "lua_type": "Map<T>"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Input<T>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 23,
                "path": "src/init.luau"
            }
        },
        {
            "name": "update",
            "desc": "Updates all the provided inputs as a shorthand\n```lua\nAxis.update(inputMap) \n```",
            "params": [],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 35,
                "path": "src/init.luau"
            }
        },
        {
            "name": "device",
            "desc": "Gets the device of the provided UserInputType (or the last UserInputType if none is provided)\n```lua\nlocal device = Axis.device() --gets device of last input\nif device == \"Desktop\" then\n\tprint(\"yay\")\nend\n```",
            "params": [],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 52,
                "path": "src/init.luau"
            }
        }
    ],
    "properties": [],
    "types": [
        {
            "name": "DeviceType",
            "desc": "",
            "lua_type": "\"Desktop\" | \"Touch\" | \"Controller\"",
            "source": {
                "line": 5,
                "path": "src/types.luau"
            }
        },
        {
            "name": "Map<T>",
            "desc": "",
            "lua_type": "{ [Enum | string]: T } & { Enum.KeyCode | Enum.UserInputType }",
            "source": {
                "line": 11,
                "path": "src/types.luau"
            }
        }
    ],
    "name": "Axis",
    "desc": "The Axis library used to define input axes, get devices, and update inputs",
    "source": {
        "line": 10,
        "path": "src/init.luau"
    }
}