"use strict";(self.webpackChunkdocs_site=self.webpackChunkdocs_site||[]).push([[8399],{8453:(e,n,r)=>{r.d(n,{R:()=>s,x:()=>i});var t=r(6540);const o={},u=t.createContext(o);function s(e){const n=t.useContext(u);return t.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:s(e.components),t.createElement(u.Provider,{value:n},e.children)}},8698:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>l,contentTitle:()=>i,default:()=>c,frontMatter:()=>s,metadata:()=>t,toc:()=>a});const t=JSON.parse('{"id":"XXTLanControl.lua/kvdb/queue/pop_front","title":"Pop From Queue Front (LCC.kvdb.queue.pop_front)","description":"Signature","source":"@site/i18n/en/docusaurus-plugin-content-docs/current/XXTLanControl.lua/kvdb/queue/pop_front.md","sourceDirName":"XXTLanControl.lua/kvdb/queue","slug":"/XXTLanControl.lua/kvdb/queue/pop_front","permalink":"/docs/en/XXTLanControl.lua/kvdb/queue/pop_front","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":40,"frontMatter":{"sidebar_position":40},"sidebar":"tutorialSidebar","previous":{"title":"Push To Queue Back (LCC.kvdb.queue.push_back)","permalink":"/docs/en/XXTLanControl.lua/kvdb/queue/push_back"},"next":{"title":"Pop From Queue Back (LCC.kvdb.queue.pop_back)","permalink":"/docs/en/XXTLanControl.lua/kvdb/queue/pop_back"}}');var o=r(4848),u=r(8453);const s={sidebar_position:40},i="Pop From Queue Front (LCC.kvdb.queue.pop_front)",l={},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,u.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.header,{children:(0,o.jsx)(n.h1,{id:"pop-from-queue-front-lcckvdbqueuepop_front",children:"Pop From Queue Front (LCC.kvdb.queue.pop_front)"})}),"\n",(0,o.jsx)(n.h2,{id:"signature",children:"Signature"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-lua",children:"value, err = LCC.kvdb.queue.pop_front(name, timeout?)\nvalues, err = LCC.kvdb.queue.pop_front({name = name, max = n}, timeout?)\n"})}),"\n",(0,o.jsx)(n.h2,{id:"parameters",children:"Parameters"}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:["name",(0,o.jsx)(n.br,{}),"\n","String. Queue name (non-empty, max ",(0,o.jsx)(n.code,{children:"256"})," bytes). Pass ",(0,o.jsx)(n.code,{children:'{name = "...", max = n}'})," for batch pop."]}),"\n",(0,o.jsxs)(n.li,{children:["timeout",(0,o.jsx)(n.br,{}),"\n","Number, optional. Request timeout in seconds, default ",(0,o.jsx)(n.code,{children:"60"}),"."]}),"\n"]}),"\n",(0,o.jsx)(n.h2,{id:"returns",children:"Returns"}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:["value",(0,o.jsx)(n.br,{}),"\n","String. The item removed from the head; ",(0,o.jsx)(n.code,{children:"nil"})," when the queue is empty."]}),"\n",(0,o.jsxs)(n.li,{children:["values\nString array. Items removed in batch mode; ",(0,o.jsx)(n.code,{children:"{}"})," when the queue is empty."]}),"\n",(0,o.jsxs)(n.li,{children:["err",(0,o.jsx)(n.br,{}),"\n","String or ",(0,o.jsx)(n.code,{children:"nil"}),". Single-value mode returns ",(0,o.jsx)(n.code,{children:"'not found'"})," when the queue is empty or missing."]}),"\n"]}),"\n",(0,o.jsx)(n.h2,{id:"notes",children:"Notes"}),"\n",(0,o.jsxs)(n.blockquote,{children:["\n",(0,o.jsxs)(n.p,{children:["Removes and returns the first element from the queue.",(0,o.jsx)(n.br,{}),"\n","Batch mode returns up to ",(0,o.jsx)(n.code,{children:"max"})," items in actual pop order.\nReturns ",(0,o.jsx)(n.code,{children:"nil, 'not found'"})," when the queue is empty."]}),"\n"]}),"\n",(0,o.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-lua",children:'local value, err = LCC.kvdb.queue.pop_front("pending")\nif value then\n    print("Processing", value)\nend\n\nlocal values, batch_err = LCC.kvdb.queue.pop_front({name = "pending", max = 3})\nfor _, item in ipairs(values or {}) do\n    print("Processing", item)\nend\n'})})]})}function c(e={}){const{wrapper:n}={...(0,u.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(d,{...e})}):d(e)}}}]);