"use strict";(self.webpackChunkdocs_site=self.webpackChunkdocs_site||[]).push([[8529],{2987:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>i,contentTitle:()=>a,default:()=>d,frontMatter:()=>u,metadata:()=>t,toc:()=>o});const t=JSON.parse('{"id":"XXTLanControl.lua/kvdb/queue/clear","title":"Clear Entire Queue (LCC.kvdb.queue.clear)","description":"Signature","source":"@site/i18n/en/docusaurus-plugin-content-docs/current/XXTLanControl.lua/kvdb/queue/clear.md","sourceDirName":"XXTLanControl.lua/kvdb/queue","slug":"/XXTLanControl.lua/kvdb/queue/clear","permalink":"/docs/en/XXTLanControl.lua/kvdb/queue/clear","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":90,"frontMatter":{"sidebar_position":90},"sidebar":"tutorialSidebar","previous":{"title":"List Queue Contents (LCC.kvdb.queue.list)","permalink":"/docs/en/XXTLanControl.lua/kvdb/queue/list"},"next":{"title":"Count Value Occurrences (LCC.kvdb.queue.count)","permalink":"/docs/en/XXTLanControl.lua/kvdb/queue/count"}}');var l=r(4848),s=r(8453);const u={sidebar_position:90},a="Clear Entire Queue (LCC.kvdb.queue.clear)",i={},o=[{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,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(n.header,{children:(0,l.jsx)(n.h1,{id:"clear-entire-queue-lcckvdbqueueclear",children:"Clear Entire Queue (LCC.kvdb.queue.clear)"})}),"\n",(0,l.jsx)(n.h2,{id:"signature",children:"Signature"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-lua",children:"values, err = LCC.kvdb.queue.clear(name, timeout?)\n"})}),"\n",(0,l.jsx)(n.h2,{id:"parameters",children:"Parameters"}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsxs)(n.li,{children:["name",(0,l.jsx)(n.br,{}),"\n","String. Queue name (non-empty, max ",(0,l.jsx)(n.code,{children:"256"})," bytes)."]}),"\n",(0,l.jsxs)(n.li,{children:["timeout",(0,l.jsx)(n.br,{}),"\n","Number, optional. Request timeout in seconds, default ",(0,l.jsx)(n.code,{children:"60"}),"."]}),"\n"]}),"\n",(0,l.jsx)(n.h2,{id:"returns",children:"Returns"}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsxs)(n.li,{children:["values",(0,l.jsx)(n.br,{}),"\n","Table. Array of elements before clearing; returns an empty array when the queue was already empty, or ",(0,l.jsx)(n.code,{children:"nil"})," on failure."]}),"\n",(0,l.jsxs)(n.li,{children:["err",(0,l.jsx)(n.br,{}),"\n","String or ",(0,l.jsx)(n.code,{children:"nil"}),". Error description when the call fails."]}),"\n"]}),"\n",(0,l.jsx)(n.h2,{id:"notes",children:"Notes"}),"\n",(0,l.jsxs)(n.blockquote,{children:["\n",(0,l.jsxs)(n.p,{children:["Clears the queue and returns a snapshot of the previous items.",(0,l.jsx)(n.br,{}),"\n","Handy for resetting queue state or migrating data."]}),"\n"]}),"\n",(0,l.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-lua",children:'local removed, err = LCC.kvdb.queue.clear("pending")\nif removed then\n    LCC.log(1, "Queue cleared", #removed)\nend\n'})})]})}function d(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,l.jsx)(n,{...e,children:(0,l.jsx)(c,{...e})}):c(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>u,x:()=>a});var t=r(6540);const l={},s=t.createContext(l);function u(e){const n=t.useContext(s);return t.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(l):e.components||l:u(e.components),t.createElement(s.Provider,{value:n},e.children)}}}]);