14 posts
Posted 27 December 2012 - 05:45 PM
right, i know this is a lame-o question you all know, but how can i make it so something happens when someone hits a key…
I was pretty sure it went along the lines of
local input = os.pullEvent("key")
if input == "28" then
{code}
But that dosen't seem to work.
Help?
1111 posts
Location
Portland OR
Posted 27 December 2012 - 05:50 PM
os.pullEvent() returns the following, event type, param1, param2, param3, param4, and param5.
With they key events it only uses param1 so to capture the key pressed do..
local event, input = os.pullEvent("key")
14 posts
Posted 27 December 2012 - 06:04 PM
Ohh i was so close!
Thanks for the help! Heroes like you save the day :D/>
2005 posts
Posted 27 December 2012 - 10:47 PM
Note that also makes it so that nothing will happen until someone hits a key.
You can also pull events without specifying the event to pull, by not passing anything to the function. This makes it so that the program can continue on receiving any event type, and you can sort out how to respond (or whether to respond) to whatever event you get.