"use strict";(self.webpackChunkdocs_site=self.webpackChunkdocs_site||[]).push([[3203],{6791:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>o,contentTitle:()=>s,default:()=>u,frontMatter:()=>i,metadata:()=>r,toc:()=>a});const r=JSON.parse('{"id":"XXTLanControl.lua/kvdb/dict/delete","title":"Delete A Key (LCC.kvdb.dict.delete)","description":"Signature","source":"@site/i18n/en/docusaurus-plugin-content-docs/current/XXTLanControl.lua/kvdb/dict/delete.md","sourceDirName":"XXTLanControl.lua/kvdb/dict","slug":"/XXTLanControl.lua/kvdb/dict/delete","permalink":"/docs/en/XXTLanControl.lua/kvdb/dict/delete","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":80,"frontMatter":{"sidebar_position":80},"sidebar":"tutorialSidebar","previous":{"title":"Fetch Entire Dictionary (LCC.kvdb.dict.get_all)","permalink":"/docs/en/XXTLanControl.lua/kvdb/dict/get_all"},"next":{"title":"Clear Dictionary (LCC.kvdb.dict.clear)","permalink":"/docs/en/XXTLanControl.lua/kvdb/dict/clear"}}');var l=t(4848),d=t(8453);const i={sidebar_position:80},s="Delete A Key (LCC.kvdb.dict.delete)",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 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,d.R)(),...e.components};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(n.header,{children:(0,l.jsx)(n.h1,{id:"delete-a-key-lcckvdbdictdelete",children:"Delete A Key (LCC.kvdb.dict.delete)"})}),"\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:"value, err = LCC.kvdb.dict.delete(name, key, 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. Dictionary name (non-empty, max ",(0,l.jsx)(n.code,{children:"256"})," bytes)."]}),"\n",(0,l.jsxs)(n.li,{children:["key",(0,l.jsx)(n.br,{}),"\n","String. Key to remove (must be valid UTF-8 and non-empty)."]}),"\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:["value",(0,l.jsx)(n.br,{}),"\n","String. Removed value; ",(0,l.jsx)(n.code,{children:"nil"})," when the key was absent."]}),"\n",(0,l.jsxs)(n.li,{children:["err",(0,l.jsx)(n.br,{}),"\n","String or ",(0,l.jsx)(n.code,{children:"nil"}),". Returns ",(0,l.jsx)(n.code,{children:"'not found'"})," when nothing was deleted."]}),"\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:["Deletes the specified key and returns its previous value.",(0,l.jsx)(n.br,{}),"\n","Handy for read-and-delete workflows when paired with ",(0,l.jsx)(n.code,{children:"get"}),"."]}),"\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 old, err = LCC.kvdb.dict.delete("settings", "temporary")\nif old then\n    LCC.log(2, "Removed stale config", old)\nend\n'})})]})}function u(e={}){const{wrapper:n}={...(0,d.R)(),...e.components};return n?(0,l.jsx)(n,{...e,children:(0,l.jsx)(c,{...e})}):c(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>i,x:()=>s});var r=t(6540);const l={},d=r.createContext(l);function i(e){const n=r.useContext(d);return r.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function s(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(l):e.components||l:i(e.components),r.createElement(d.Provider,{value:n},e.children)}}}]);