Pārlūkot izejas kodu

Document Channel:peek second return value;

bjorn 5 gadi atpakaļ
vecāks
revīzija
be8edcbcc7
2 mainītis faili ar 17 papildinājumiem un 3 dzēšanām
  1. 8 2
      api/init.lua
  2. 9 1
      api/lovr/thread/Channel/peek.lua

+ 8 - 2
api/init.lua

@@ -22944,11 +22944,17 @@ return {
                     {
                       name = "message",
                       type = "*",
-                      description = "The message."
+                      description = "The message, or `nil` if there is no message."
+                    },
+                    {
+                      name = "present",
+                      type = "boolean",
+                      description = "Whether a message was returned."
                     }
                   }
                 }
-              }
+              },
+              notes = "The second return value can be used to detect if a `nil` message is in the queue."
             },
             {
               name = "pop",

+ 9 - 1
api/lovr/thread/Channel/peek.lua

@@ -9,9 +9,17 @@ return {
     {
       name = 'message',
       type = '*',
-      description = 'The message.'
+      description = 'The message, or `nil` if there is no message.'
+    },
+    {
+      name = 'present',
+      type = 'boolean',
+      description = 'Whether a message was returned.'
     }
   },
+  notes = [[
+    The second return value can be used to detect if a `nil` message is in the queue.
+  ]],
   related = {
     'Channel:pop'
   }