push.lua 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. return {
  2. summary = 'Push a message onto the Channel.',
  3. description = [[
  4. Pushes a message onto the Channel. The following types of data can be pushed: nil, boolean,
  5. number, string, lightuserdata, vectors, and userdata (LÖVR objects). Notably, tables are not
  6. currently supported and should be serialized to strings.
  7. ]],
  8. arguments = {
  9. message = {
  10. type = '*',
  11. description = 'The message to push.'
  12. },
  13. wait = {
  14. type = 'number',
  15. default = 'false',
  16. description = [[
  17. How long to wait for the message to be popped, in seconds. `true` can be used to wait
  18. forever and `false` can be used to avoid waiting.
  19. ]]
  20. }
  21. },
  22. returns = {
  23. id = {
  24. type = 'number',
  25. description = 'The ID of the pushed message.'
  26. },
  27. read = {
  28. type = 'boolean',
  29. description = 'Whether the message was read by another thread before the wait timeout.'
  30. }
  31. },
  32. variants = {
  33. {
  34. arguments = { 'message', 'wait' },
  35. returns = { 'id', 'read' }
  36. }
  37. },
  38. notes = 'Threads can get stuck forever waiting on Channel messages, so be careful.',
  39. related = {
  40. 'Channel:pop',
  41. 'Channel:hasRead'
  42. }
  43. }