VERGELua API

input

Buttons, key presses, mouse state.

input.IsButtonDown(key:number):boolean

Whether a button is held down.

input.IsKeyPressed(key:number):boolean

Whether a key was pressed this tick.

input.IsKeyReleased(key:number):boolean

Whether a key was released this tick.

input.GetMousePosition():number,number

Current mouse cursor position.

input.GetKeyName(key:number):string

Display name for a Windows VK code.

input.GetMousePos():number,number

Alias of GetMousePosition.

input.IsButtonPressed(button:number):boolean,number

Pressed state and the tick it was pressed.

input.IsButtonReleased(button:number):boolean,number

Released state and the tick it was released.

input.IsMouseInputEnabled():boolean

Whether mouse input is enabled for Lua.

input.SetMouseInputEnabled(enabled:boolean)

Enable or disable mouse input.

input.GetPollTick():number

Engine tick of the current frame.

Examples

Toggle FOV with a key

Tap F8 to switch your FOV between 90 and 120, with a toast.

local wide = false

callbacks.Register("CreateMove", function()
    if input.IsButtonPressed(KEY_F8) then
        wide = not wide
        client.SetConVar("fov_desired", wide and 120 or 90)
        engine.Notification("FOV", wide and "120" or "90")
    end
end)