pop.lua 887 B

12345678910111213141516171819202122232425262728293031323334
  1. return {
  2. summary = 'Pop a message from the Channel.',
  3. description = [[
  4. Pops a message from the Channel. If the Channel is empty, an optional timeout argument can be
  5. used to wait for a message, otherwise `nil` is returned.
  6. ]],
  7. arguments = {
  8. wait = {
  9. type = 'number',
  10. default = 'false',
  11. description = [[
  12. How long to wait for a message to be popped, in seconds. `true` can be used to wait forever
  13. and `false` can be used to avoid waiting.
  14. ]]
  15. }
  16. },
  17. returns = {
  18. message = {
  19. type = '*',
  20. description = 'The received message, or `nil` if nothing was received.'
  21. }
  22. },
  23. variants = {
  24. {
  25. arguments = { 'wait' },
  26. returns = { 'message' }
  27. }
  28. },
  29. notes = 'Threads can get stuck forever waiting on Channel messages, so be careful.',
  30. related = {
  31. 'Channel:peek',
  32. 'Channel:push'
  33. }
  34. }