Skip to main content

IsKeyBeingReleased

This function was added in DSL 1

Description

Check if a key was just released, meaning it is not pressed this frame but was on the previous one.

key and controller are interpreted the same way as they are by IsKeyPressed.

function IsKeyBeingReleased(key, controller) --[[ ... ]] end

Parameters

  • key: string - The name of the key to check.
  • controller?: 0|1|2|3 - (Optional) The controller to check the key on. Defaults to 0, which is the keyboard.

Return Values

  • justReleased: boolean - Returns true if the key was just released, otherwise false.

Versions

  • DSL4 - DirectInput keyboard scan codes are now used, but virtual key code names will still be converted for legacy support.
  • DSL6 - The optional controller argument was added.

Example

function main()
local key = 'W'
while true do
if IsKeyBeingReleased(key) then
DrawTextInline(key .. ' key was just released!', 0, 1)
end
Wait(0)
end
end

See Also