"use strict";(self.webpackChunkdocs_site=self.webpackChunkdocs_site||[]).push([[311],{1114:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>d,default:()=>u,frontMatter:()=>l,metadata:()=>r,toc:()=>o});const r=JSON.parse('{"id":"XXTLanControl.lua/kvdb/dict/get","title":"Read A Key (LCC.kvdb.dict.get)","description":"Signature","source":"@site/i18n/en/docusaurus-plugin-content-docs/current/XXTLanControl.lua/kvdb/dict/get.md","sourceDirName":"XXTLanControl.lua/kvdb/dict","slug":"/XXTLanControl.lua/kvdb/dict/get","permalink":"/docs/en/XXTLanControl.lua/kvdb/dict/get","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":60,"frontMatter":{"sidebar_position":60},"sidebar":"tutorialSidebar","previous":{"title":"Atomic Increment/Decrement (LCC.kvdb.dict.incr)","permalink":"/docs/en/XXTLanControl.lua/kvdb/dict/incr"},"next":{"title":"Fetch Entire Dictionary (LCC.kvdb.dict.get_all)","permalink":"/docs/en/XXTLanControl.lua/kvdb/dict/get_all"}}');var i=t(4848),s=t(8453);const l={sidebar_position:60},d="Read A Key (LCC.kvdb.dict.get)",c={},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 a(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,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.header,{children:(0,i.jsx)(n.h1,{id:"read-a-key-lcckvdbdictget",children:"Read A Key (LCC.kvdb.dict.get)"})}),"\n",(0,i.jsx)(n.h2,{id:"signature",children:"Signature"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-lua",children:"value, err = LCC.kvdb.dict.get(name, key, timeout?)\n"})}),"\n",(0,i.jsx)(n.h2,{id:"parameters",children:"Parameters"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["name",(0,i.jsx)(n.br,{}),"\n","String. Dictionary name (non-empty, max ",(0,i.jsx)(n.code,{children:"256"})," bytes)."]}),"\n",(0,i.jsxs)(n.li,{children:["key",(0,i.jsx)(n.br,{}),"\n","String. Key to read (must be valid UTF-8 and non-empty)."]}),"\n",(0,i.jsxs)(n.li,{children:["timeout",(0,i.jsx)(n.br,{}),"\n","Number, optional. Request timeout in seconds, default ",(0,i.jsx)(n.code,{children:"60"}),"."]}),"\n"]}),"\n",(0,i.jsx)(n.h2,{id:"returns",children:"Returns"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["value",(0,i.jsx)(n.br,{}),"\n","String. Value stored for the key; ",(0,i.jsx)(n.code,{children:"nil"})," when missing."]}),"\n",(0,i.jsxs)(n.li,{children:["err",(0,i.jsx)(n.br,{}),"\n","String or ",(0,i.jsx)(n.code,{children:"nil"}),". Returns ",(0,i.jsx)(n.code,{children:"'not found'"})," when the key is absent."]}),"\n"]}),"\n",(0,i.jsx)(n.h2,{id:"notes",children:"Notes"}),"\n",(0,i.jsxs)(n.blockquote,{children:["\n",(0,i.jsxs)(n.p,{children:["Fetches the value for the given key.",(0,i.jsx)(n.br,{}),"\n","Missing keys return ",(0,i.jsx)(n.code,{children:"nil, 'not found'"}),"."]}),"\n"]}),"\n",(0,i.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-lua",children:'local value, err = LCC.kvdb.dict.get("settings", "retry")\nif value then\n    print("Current retry count:", value)\nend\n'})})]})}function u(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(a,{...e})}):a(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>l,x:()=>d});var r=t(6540);const i={},s=r.createContext(i);function l(e){const n=r.useContext(s);return r.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function d(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:l(e.components),r.createElement(s.Provider,{value:n},e.children)}}}]);