init.lua 779 B

12345678910111213141516171819202122232425
  1. return {
  2. tag = 'modules',
  3. summary = 'Handles events from the operating system.',
  4. description = [[
  5. The `lovr.event` module handles events from the operating system.
  6. Due to its low-level nature, it's rare to use `lovr.event` in simple projects.
  7. ]],
  8. notes = [[
  9. You can define your own custom events by adding a function to the `lovr.handlers` table with a
  10. key of the name of the event you want to add. Then, push the event using `lovr.event.push`.
  11. ]],
  12. example = {
  13. description = 'Adding a custom event.',
  14. code = [[
  15. function lovr.load()
  16. lovr.handlers['customevent'] = function(a, b, c)
  17. print('custom event handled with args:', a, b, c)
  18. end
  19. lovr.event.push('customevent', 1, 2, 3)
  20. end
  21. ]]
  22. }
  23. }