"use strict";(self.webpackChunkdocs_site=self.webpackChunkdocs_site||[]).push([[7506],{2554:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>l,contentTitle:()=>u,default:()=>d,frontMatter:()=>a,metadata:()=>t,toc:()=>i});const t=JSON.parse('{"id":"XXTLanControl.lua/kvdb/queue/pop_back","title":"Pop From Queue Back (LCC.kvdb.queue.pop_back)","description":"Signature","source":"@site/i18n/en/docusaurus-plugin-content-docs/current/XXTLanControl.lua/kvdb/queue/pop_back.md","sourceDirName":"XXTLanControl.lua/kvdb/queue","slug":"/XXTLanControl.lua/kvdb/queue/pop_back","permalink":"/docs/en/XXTLanControl.lua/kvdb/queue/pop_back","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":50,"frontMatter":{"sidebar_position":50},"sidebar":"tutorialSidebar","previous":{"title":"Pop From Queue Front (LCC.kvdb.queue.pop_front)","permalink":"/docs/en/XXTLanControl.lua/kvdb/queue/pop_front"},"next":{"title":"Atomically Move Queue Items (LCC.kvdb.queue.move)","permalink":"/docs/en/XXTLanControl.lua/kvdb/queue/move"}}');var o=r(4848),s=r(8453);const a={sidebar_position:50},u="Pop From Queue Back (LCC.kvdb.queue.pop_back)",l={},i=[{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 c(e){const n={blockquote:"blockquote",br:"br",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",ul:"ul",...(0,s.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-back-lcckvdbqueuepop_back",children:"Pop From Queue Back (LCC.kvdb.queue.pop_back)"})}),"\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_back(name, timeout?)\nvalues, err = LCC.kvdb.queue.pop_back({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. Item removed from the tail; ",(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 last 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.\nHandy for LIFO-style consumption."]}),"\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_back("pending")\nif value then\n    print("Processing latest task", value)\nend\n\nlocal values, batch_err = LCC.kvdb.queue.pop_back({name = "pending", max = 3})\nfor _, item in ipairs(values or {}) do\n    print("Processing latest task", item)\nend\n'})})]})}function d(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(c,{...e})}):c(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>a,x:()=>u});var t=r(6540);const o={},s=t.createContext(o);function a(e){const n=t.useContext(s);return t.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function u(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:a(e.components),t.createElement(s.Provider,{value:n},e.children)}}}]);