newThread.lua 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. return {
  2. summary = 'Create a new Thread.',
  3. description = 'Creates a new Thread from Lua code.',
  4. arguments = {
  5. code = {
  6. type = 'string',
  7. description = 'The code to run in the Thread.'
  8. },
  9. filename = {
  10. type = 'string',
  11. description = 'A file containing code to run in the Thread.'
  12. },
  13. blob = {
  14. type = 'Blob',
  15. description = 'The code to run in the Thread.'
  16. }
  17. },
  18. returns = {
  19. thread = {
  20. type = 'Thread',
  21. description = 'The new Thread.'
  22. }
  23. },
  24. variants = {
  25. {
  26. arguments = { 'code' },
  27. returns = { 'thread' }
  28. },
  29. {
  30. arguments = { 'filename' },
  31. returns = { 'thread' }
  32. },
  33. {
  34. arguments = { 'blob' },
  35. returns = { 'thread' }
  36. }
  37. },
  38. notes = [[
  39. The Thread won\'t start running immediately. Use `Thread:start` to start it.
  40. The string argument is assumed to be a filename if there isn't a newline in the first 1024
  41. characters. For really short thread code, an extra newline can be added to trick LÖVR into
  42. loading it properly.
  43. ]],
  44. related = {
  45. 'Thread:start',
  46. 'lovr.threaderror'
  47. }
  48. }