[Feature Request] Keyboard Function - KeyReleased() function
Posted: Fri Apr 17, 2009 8:00 pm
Is it possible to make a KeyReleased() function that detects if a key has been just released?
Reason I ask is that I am making a recording in-game coordinate system, and it needs to save the coordinate when the movement keys have been released.
One way I did do it is by waiting until the keyPressed returns false.
However I run into big problems when multiple keys are pressed, as it enters the while loop until the user releases the first detected key. Which is kinda pointless, because when moving your usually pressing forward and the left or right at the same time.
Any ideas?
Reason I ask is that I am making a recording in-game coordinate system, and it needs to save the coordinate when the movement keys have been released.
One way I did do it is by waiting until the keyPressed returns false.
Code: Select all
function keyPressedOnce(key)
if (keyPressed(key)) then
while (keyPressed(key)) do
coroutine.yield()
end
return true
end
return false
end
Any ideas?