Skip to main content

IsMouseBeingPressed

This function was added in DSL 5

Description

Check if a mouse button was just pressed this frame.

Mouse buttons are in the range of [0,3] for a total of 4 buttons.

  • 0: Left mouse button
  • 1: Right mouse button
  • 2: Middle mouse button (scroll wheel)
  • 3: Extra mouse button (if available)
function IsMouseBeingPressed(button) --[[ ... ]] end

Parameters

  • button: 0|1|2|3 - The mouse button to check.

Return Values

  • justPressed: boolean - true if the specified mouse button was just pressed, otherwise false.

Example

function main()
while true do
if IsMouseBeingPressed(0) then
DrawTextInline('Left mouse button was just pressed.', 0.5, 1) -- 500ms/0.5sec
end
Wait(0)
end
end

See Also