Skip to content

Instantly share code, notes, and snippets.

@EncodeTheCode
Created May 6, 2023 14:56
Show Gist options
  • Save EncodeTheCode/d54fad6618a5a25a3d644252af4f076f to your computer and use it in GitHub Desktop.
Save EncodeTheCode/d54fad6618a5a25a3d644252af4f076f to your computer and use it in GitHub Desktop.
while true do
local keyPress = io.read(1)
if keyPress == "w" or keyPress == "W" then
print("You just pressed W")
elseif keyPress == "a" or keyPress == "A" then
print("You just pressed A")
elseif keyPress == "s" or keyPress == "S" then
print("You just pressed S")
elseif keyPress == "d" or keyPress == "D" then
print("You just pressed D")
elseif keyPress == "\27" then -- escape key
print("You just pressed ESC")
break -- exit the loop
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment