textinput.lua 957 B

123456789101112131415161718192021222324252627282930313233
  1. return {
  2. tag = 'callbacks',
  3. summary = 'Called when text has been entered.',
  4. description = [[
  5. This callback is called when text has been entered.
  6. For example, when `shift + 1` is pressed on an American keyboard, `lovr.textinput` will be
  7. called with `!`.
  8. ]],
  9. arguments = {
  10. {
  11. name = 'text',
  12. type = 'string',
  13. description = 'The UTF-8 encoded character.'
  14. },
  15. {
  16. name = 'code',
  17. type = 'number',
  18. description = 'The integer codepoint of the character.'
  19. }
  20. },
  21. notes = [[
  22. Some characters in UTF-8 unicode take multiple bytes to encode. Due to the way Lua works, the
  23. length of these strings will be bigger than 1 even though they are just a single character. The
  24. `utf8` library included with LÖVR can be used to manipulate UTF-8 strings. `Pass:text` will
  25. also correctly handle UTF-8.
  26. ]],
  27. returns = {},
  28. related = {
  29. 'lovr.keypressed',
  30. 'lovr.keyreleased'
  31. }
  32. }