getLines.lua 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. return {
  2. summary = 'Wrap a string into a sequence of lines.',
  3. description = [[
  4. Returns a table of wrapped lines for a piece of text, given a line length limit. Newlines are
  5. handled correctly. The wrap limit units depend on the pixel density of the font. With the
  6. default pixel density, the units correspond to meters when the font is drawn at 1.0 scale.
  7. ]],
  8. arguments = {
  9. string = {
  10. type = 'string',
  11. description = 'The text to wrap.'
  12. },
  13. strings = {
  14. type = 'table',
  15. description = [[
  16. A table of colored strings, each given as a `{ color, string }` pair. The color can be a
  17. `Vec3`, `Vec4`, table, or hexcode.
  18. ]]
  19. },
  20. wrap = {
  21. type = 'number',
  22. description = 'The line length to wrap at.'
  23. }
  24. },
  25. returns = {
  26. lines = {
  27. type = 'table',
  28. description = 'A table strings, one for each wrapped line (without any color information).'
  29. }
  30. },
  31. variants = {
  32. {
  33. arguments = { 'string', 'wrap' },
  34. returns = { 'lines' }
  35. },
  36. {
  37. arguments = { 'strings', 'wrap' },
  38. returns = { 'lines' }
  39. }
  40. },
  41. related = {
  42. 'Font:getWidth',
  43. 'Font:getHeight',
  44. 'Pass:text'
  45. }
  46. }