onKeyPress

Getting triggered as long as the keyboard key is pressed.

Prototypes
onKeyPress(callback) -- callback = function(keys)
Parameters
    • function(keys): callback function
      • keys: string
Usage
onKeyPress(function(keys)
  if keys == "W" then
  	print("Move north! and keep moving")
  elseif keys == "Ctrl+W" then
  	print("Ctrl+W is pressed")
  elseif keys == "Alt+W" then
  	print("Alt+W is pressed")
  end
end)

Revision #7
Created Thu, Jan 9, 2020 12:36 AM by Admin
Updated Thu, Jan 9, 2020 11:06 PM by Vincent