wasKeyPressed.lua 899 B

12345678910111213141516171819202122232425262728293031323334
  1. return {
  2. tag = 'system-keyboard',
  3. summary = 'Check if a key was pressed this frame.',
  4. description = 'Returns whether a key on the keyboard was pressed this frame.',
  5. arguments = {
  6. ['...'] = {
  7. type = 'KeyCode',
  8. description = 'The set of keys to check.'
  9. }
  10. },
  11. returns = {
  12. pressed = {
  13. type = 'boolean',
  14. description = 'Whether any of the specified keys were pressed this frame.'
  15. }
  16. },
  17. variants = {
  18. {
  19. arguments = { '...' },
  20. returns = { 'pressed' }
  21. }
  22. },
  23. notes = [[
  24. Technically this returns whether the key was pressed between the last 2 calls to
  25. `lovr.system.pollEvents`, but that function is called automatically at the beginning of
  26. each frame in `lovr.run`, so it all works out!
  27. ]],
  28. related = {
  29. 'lovr.system.isKeyDown',
  30. 'lovr.system.wasKeyReleased',
  31. 'lovr.keypressed',
  32. 'lovr.keyreleased'
  33. }
  34. }