"use strict";(self.webpackChunkdocs_site=self.webpackChunkdocs_site||[]).push([[3243],{6285:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>o,contentTitle:()=>l,default:()=>c,frontMatter:()=>u,metadata:()=>t,toc:()=>a});const t=JSON.parse('{"id":"XXTLanControl.lua/kvdb/queue/size","title":"Retrieve Queue Length (LCC.kvdb.queue.size)","description":"Signature","source":"@site/i18n/en/docusaurus-plugin-content-docs/current/XXTLanControl.lua/kvdb/queue/size.md","sourceDirName":"XXTLanControl.lua/kvdb/queue","slug":"/XXTLanControl.lua/kvdb/queue/size","permalink":"/docs/en/XXTLanControl.lua/kvdb/queue/size","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":110,"frontMatter":{"sidebar_position":110},"sidebar":"tutorialSidebar","previous":{"title":"Count Value Occurrences (LCC.kvdb.queue.count)","permalink":"/docs/en/XXTLanControl.lua/kvdb/queue/count"},"next":{"title":"TableDB Overview","permalink":"/docs/en/XXTLanControl.lua/tabledb/"}}');var s=r(4848),i=r(8453);const u={sidebar_position:110},l="Retrieve Queue Length (LCC.kvdb.queue.size)",o={},a=[{value:"Signature",id:"signature",level:2},{value:"Parameters",id:"parameters",level:2},{value:"Returns",id:"returns",level:2},{value:"Notes",id:"notes",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={blockquote:"blockquote",br:"br",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",ul:"ul",...(0,i.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.header,{children:(0,s.jsx)(n.h1,{id:"retrieve-queue-length-lcckvdbqueuesize",children:"Retrieve Queue Length (LCC.kvdb.queue.size)"})}),"\n",(0,s.jsx)(n.h2,{id:"signature",children:"Signature"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-lua",children:"size, err = LCC.kvdb.queue.size(name, timeout?)\n"})}),"\n",(0,s.jsx)(n.h2,{id:"parameters",children:"Parameters"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["name",(0,s.jsx)(n.br,{}),"\n","String. Queue name (non-empty, max ",(0,s.jsx)(n.code,{children:"256"})," bytes)."]}),"\n",(0,s.jsxs)(n.li,{children:["timeout",(0,s.jsx)(n.br,{}),"\n","Number, optional. Request timeout in seconds, default ",(0,s.jsx)(n.code,{children:"60"}),"."]}),"\n"]}),"\n",(0,s.jsx)(n.h2,{id:"returns",children:"Returns"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["size",(0,s.jsx)(n.br,{}),"\n","Number. Current number of items; returns ",(0,s.jsx)(n.code,{children:"0"})," for empty queues, or ",(0,s.jsx)(n.code,{children:"nil"})," on failure."]}),"\n",(0,s.jsxs)(n.li,{children:["err",(0,s.jsx)(n.br,{}),"\n","String or ",(0,s.jsx)(n.code,{children:"nil"}),". Error description when the call fails."]}),"\n"]}),"\n",(0,s.jsx)(n.h2,{id:"notes",children:"Notes"}),"\n",(0,s.jsxs)(n.blockquote,{children:["\n",(0,s.jsxs)(n.p,{children:["Returns the queue length directly, faster than calling ",(0,s.jsx)(n.code,{children:"list"})," and counting.",(0,s.jsx)(n.br,{}),"\n","Empty queues return ",(0,s.jsx)(n.code,{children:"0"}),"."]}),"\n"]}),"\n",(0,s.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-lua",children:'local size, err = LCC.kvdb.queue.size("pending")\nif size then\n    print("Queued:", size)\nend\n'})})]})}function c(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(d,{...e})}):d(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>u,x:()=>l});var t=r(6540);const s={},i=t.createContext(s);function u(e){const n=t.useContext(i);return t.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:u(e.components),t.createElement(i.Provider,{value:n},e.children)}}}]);