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 to0
, which is the keyboard.
Return Values
justReleased
:boolean
- Returnstrue
if the key was just released, otherwisefalse
.
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
- DSL
IsKeyBeingPressed
- Checks if a key was just pressed.IsKeyPressed
- Checks if a key is currently pressed.IsKeyValid
- Checks if a key is valid.