"use strict";(self.webpackChunkdocs_site=self.webpackChunkdocs_site||[]).push([[5125],{634:(e,n,l)=>{l.r(n),l.d(n,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>r,metadata:()=>t,toc:()=>o});const t=JSON.parse('{"id":"XXTLanControl.lua/kvdb/dict/put","title":"\u5199\u5165\u5e76\u8fd4\u56de\u539f\u503c (LCC.kvdb.dict.put)","description":"\u58f0\u660e","source":"@site/docs/XXTLanControl.lua/kvdb/dict/put.md","sourceDirName":"XXTLanControl.lua/kvdb/dict","slug":"/XXTLanControl.lua/kvdb/dict/put","permalink":"/docs/XXTLanControl.lua/kvdb/dict/put","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":20,"frontMatter":{"sidebar_position":20},"sidebar":"tutorialSidebar","previous":{"title":"Dict \u8bcd\u5178\u63a5\u53e3","permalink":"/docs/XXTLanControl.lua/kvdb/dict/"},"next":{"title":"\u79fb\u52a8\u952e\u503c (LCC.kvdb.dict.move_value)","permalink":"/docs/XXTLanControl.lua/kvdb/dict/move_value"}}');var d=l(4848),i=l(8453);const r={sidebar_position:20},s="\u5199\u5165\u5e76\u8fd4\u56de\u539f\u503c (LCC.kvdb.dict.put)",c={},o=[{value:"\u58f0\u660e",id:"\u58f0\u660e",level:2},{value:"\u53c2\u6570",id:"\u53c2\u6570",level:2},{value:"\u8fd4\u56de\u503c",id:"\u8fd4\u56de\u503c",level:2},{value:"\u8bf4\u660e",id:"\u8bf4\u660e",level:2},{value:"\u793a\u4f8b",id:"\u793a\u4f8b",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,i.R)(),...e.components};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(n.header,{children:(0,d.jsx)(n.h1,{id:"\u5199\u5165\u5e76\u8fd4\u56de\u539f\u503c-lcckvdbdictput",children:"\u5199\u5165\u5e76\u8fd4\u56de\u539f\u503c (LCC.kvdb.dict.put)"})}),"\n",(0,d.jsx)(n.h2,{id:"\u58f0\u660e",children:"\u58f0\u660e"}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-lua",children:"old_value, err = LCC.kvdb.dict.put(name, key, value, timeout?)\n"})}),"\n",(0,d.jsx)(n.h2,{id:"\u53c2\u6570",children:"\u53c2\u6570"}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:["name",(0,d.jsx)(n.br,{}),"\n","\u5b57\u7b26\u4e32\u578b\uff0c\u8bcd\u5178\u540d\u79f0\uff08\u975e\u7a7a\uff0c\u6700\u957f ",(0,d.jsx)(n.code,{children:"256"})," \u5b57\u8282\uff09"]}),"\n",(0,d.jsxs)(n.li,{children:["key",(0,d.jsx)(n.br,{}),"\n","\u5b57\u7b26\u4e32\u578b\uff0c\u952e\u540d\uff08\u5fc5\u987b\u4e3a\u5408\u6cd5 UTF-8\uff0c\u4e14\u975e\u7a7a\uff09"]}),"\n",(0,d.jsxs)(n.li,{children:["value",(0,d.jsx)(n.br,{}),"\n","\u5b57\u7b26\u4e32\u578b\uff0c\u65b0\u503c\uff08\u5fc5\u987b\u4e3a\u5408\u6cd5 UTF-8\uff09"]}),"\n",(0,d.jsxs)(n.li,{children:["timeout",(0,d.jsx)(n.br,{}),"\n","\u6570\u503c\u578b\uff0c\u53ef\u9009\uff1b\u8bf7\u6c42\u8d85\u65f6\u65f6\u95f4\uff08\u79d2\uff09\uff0c\u9ed8\u8ba4 ",(0,d.jsx)(n.code,{children:"60"})]}),"\n"]}),"\n",(0,d.jsx)(n.h2,{id:"\u8fd4\u56de\u503c",children:"\u8fd4\u56de\u503c"}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:["old_value",(0,d.jsx)(n.br,{}),"\n","\u5b57\u7b26\u4e32\u578b\u6216 ",(0,d.jsx)(n.code,{children:"nil"}),"\uff0c\u6210\u529f\u65f6\u8fd4\u56de\u66ff\u6362\u524d\u7684\u65e7\u503c\uff1b\u82e5\u4e3a\u65b0\u952e\u5219\u8fd4\u56de ",(0,d.jsx)(n.code,{children:"nil"})]}),"\n",(0,d.jsxs)(n.li,{children:["err",(0,d.jsx)(n.br,{}),"\n","\u5b57\u7b26\u4e32\u578b\u6216 ",(0,d.jsx)(n.code,{children:"nil"}),"\uff0c\u6210\u529f\u65f6\u8fd4\u56de ",(0,d.jsx)(n.code,{children:"nil"}),"\uff1b\u53d1\u751f\u9519\u8bef\u65f6\u8fd4\u56de\u9519\u8bef\u63cf\u8ff0"]}),"\n"]}),"\n",(0,d.jsx)(n.h2,{id:"\u8bf4\u660e",children:"\u8bf4\u660e"}),"\n",(0,d.jsxs)(n.blockquote,{children:["\n",(0,d.jsxs)(n.p,{children:['\u5199\u5165\u952e\u503c\u5e76\u8fd4\u56de\u65e7\u503c\uff0c\u53ef\u4ee5\u7528\u6765\u5b9e\u73b0"\u8bbe\u7f6e\u5e76\u83b7\u53d6\u65e7\u503c"\u7684\u539f\u5b50\u64cd\u4f5c\u3002',(0,d.jsx)(n.br,{}),"\n","\u8bf7\u6c42\u5931\u8d25\u65f6\u8fd4\u56de ",(0,d.jsx)(n.code,{children:"false, \u9519\u8bef\u4fe1\u606f"}),"\u3002"]}),"\n"]}),"\n",(0,d.jsx)(n.h2,{id:"\u793a\u4f8b",children:"\u793a\u4f8b"}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{className:"language-lua",children:'local old, err = LCC.kvdb.dict.put("\u914d\u7f6e", "\u91cd\u8bd5\u6b21\u6570", "3")\nif old == false then\n    error(err)\nend\n'})})]})}function u(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,d.jsx)(n,{...e,children:(0,d.jsx)(a,{...e})}):a(e)}},8453:(e,n,l)=>{l.d(n,{R:()=>r,x:()=>s});var t=l(6540);const d={},i=t.createContext(d);function r(e){const n=t.useContext(i);return t.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(d):e.components||d:r(e.components),t.createElement(i.Provider,{value:n},e.children)}}}]);