Skip to main content

IsKeyBeingPressed

This function was added in DSL 1

Description

Check if a keyboard key was just pressed.

This should be a string representing the key, such as 'W', 'A', 'S', 'D', etc. The key names are case-sensitive.

function IsKeyBeingPressed(key) --[[ ... ]] end

Parameters

  • key: string - The name of the key to check.

Return Values

  • justPressed: boolean - Returns true if the key was just pressed, otherwise false.

Example

if IsKeyBeingPressed('W') then
print('W key was just pressed!')
end

See Also