hi i a newbie in game studio, im having trouble finding a easy thing like detect the state of a key, for example i want to run a function when i released the space key.

for example i want to turn a light on or off when the user press space but just when he release it, because if he keeps pressing down the key the function is calling a lots of times.

So how i detect when i released the key pressed?