getRawLastKey() only return the last key to be pressed, even after it's been released. This snippet will track multiple keys so that getLastKeyPress() will return whichever key is currently still pressed. So if you press multiple keys then release one, it'll return the last key that's still pressed down, where the AGK version could still return the number of the key you've already released.