peek.lua 789 B

123456789101112131415161718192021222324252627282930
  1. return {
  2. summary = 'Look at a message from the Channel without popping it.',
  3. description = [[
  4. Returns a message from the Channel without popping it from the queue. If the Channel is empty,
  5. `nil` is returned. This can be useful to determine if the Channel is empty.
  6. ]],
  7. arguments = {},
  8. returns = {
  9. message = {
  10. type = '*',
  11. description = 'The message, or `nil` if there is no message.'
  12. },
  13. present = {
  14. type = 'boolean',
  15. description = 'Whether a message was returned (use to detect nil).'
  16. }
  17. },
  18. variants = {
  19. {
  20. arguments = {},
  21. returns = { 'message', 'present' }
  22. }
  23. },
  24. notes = [[
  25. The second return value can be used to detect if a `nil` message is in the queue.
  26. ]],
  27. related = {
  28. 'Channel:pop'
  29. }
  30. }