keyboard_lastkey

This variable refers to the value that keyboard_key was in the previous frame, returning the keycode of that key (all standard keycode constants are returned).

This variable is not read-only and you can change it, for example to set it to vk_nokey if you handled it already.

 

Syntax:

keyboard_lastkey

 

Returns:

Virtual Key Constant (vk_*)

 

Example:

if (keyboard_lastkey != vk_nokey)
{
    str += keyboard_lastchar;
    keyboard_lastkey = vk_nokey;
}

The above code checks to see if the keyboard_lastkey variable is not equal to vk_nokey, and if it is it adds whatever the last key was as a string to the variable str, then it resets the keyboard_lastkey variable to accept further input.