ackley14 Posted March 9, 2017 Posted March 9, 2017 Keyboard.isKeyDown(keyboard.keys.space) and other variants are always returning nil and i'm not sure why! here's my code keyboard = require("keyboard") while true do print(keyboard.isKeyDown(keyboard.keys.space)) end this returns nil over and over. no amount of button pressing changes the output for whatever reason any ideas why? Quote
1 Molinko Posted March 9, 2017 Posted March 9, 2017 Key presses are events. You need to yield (i.e event.pull ) to catch them. Try this.. require('event').pull('key') print( require('keyboard').isKeyDown( 0x39 ) ) Quote
1 Gorzoid Posted March 9, 2017 Posted March 9, 2017 This may be because you are not sleeping, if you constantly check without yielding then it can't check keys pressed, add an os.sleep call before or after the print Quote
Keyboard.isKeyDown(keyboard.keys.space) and other variants are always returning nil and i'm not sure why!
here's my code
keyboard = require("keyboard") while true do print(keyboard.isKeyDown(keyboard.keys.space)) endthis returns nil over and over. no amount of button pressing changes the output for whatever reason
any ideas why?