Created
May 6, 2023 14:56
-
-
Save EncodeTheCode/d54fad6618a5a25a3d644252af4f076f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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