"use strict";(self.webpackChunkdocs_site=self.webpackChunkdocs_site||[]).push([[3094],{1740:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"XXTLanControl.lua/kvdb/dict/move_value","title":"Move A Key (LCC.kvdb.dict.move_value)","description":"Signature","source":"@site/i18n/en/docusaurus-plugin-content-docs/current/XXTLanControl.lua/kvdb/dict/move_value.md","sourceDirName":"XXTLanControl.lua/kvdb/dict","slug":"/XXTLanControl.lua/kvdb/dict/move_value","permalink":"/docs/en/XXTLanControl.lua/kvdb/dict/move_value","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":30,"frontMatter":{"sidebar_position":30},"sidebar":"tutorialSidebar","previous":{"title":"Write Key And Return Previous Value (LCC.kvdb.dict.put)","permalink":"/docs/en/XXTLanControl.lua/kvdb/dict/put"},"next":{"title":"Copy A Key (LCC.kvdb.dict.copy_value)","permalink":"/docs/en/XXTLanControl.lua/kvdb/dict/copy_value"}}');var r=t(4848),o=t(8453);const i={sidebar_position:30},a="Move A Key (LCC.kvdb.dict.move_value)",l={},d=[{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,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.header,{children:(0,r.jsx)(n.h1,{id:"move-a-key-lcckvdbdictmove_value",children:"Move A Key (LCC.kvdb.dict.move_value)"})}),"\n",(0,r.jsx)(n.h2,{id:"signature",children:"Signature"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-lua",children:"ok, old_value_or_err = LCC.kvdb.dict.move_value(src_name, src_key, dst_name?, dst_key?, timeout?)\n"})}),"\n",(0,r.jsx)(n.h2,{id:"parameters",children:"Parameters"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["src_name",(0,r.jsx)(n.br,{}),"\n","String. Source dictionary name (non-empty, max ",(0,r.jsx)(n.code,{children:"256"})," bytes)."]}),"\n",(0,r.jsxs)(n.li,{children:["src_key",(0,r.jsx)(n.br,{}),"\n","String. Source key (must be valid UTF-8 and non-empty)."]}),"\n",(0,r.jsxs)(n.li,{children:["dst_name",(0,r.jsx)(n.br,{}),"\n","String, optional. Destination dictionary name, defaults to the source name (non-empty, max ",(0,r.jsx)(n.code,{children:"256"})," bytes)."]}),"\n",(0,r.jsxs)(n.li,{children:["dst_key",(0,r.jsx)(n.br,{}),"\n","String, optional. Destination key, defaults to the source key (must be valid UTF-8 and non-empty)."]}),"\n",(0,r.jsxs)(n.li,{children:["timeout",(0,r.jsx)(n.br,{}),"\n","Number, optional. Request timeout in seconds, default ",(0,r.jsx)(n.code,{children:"60"}),"."]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"returns",children:"Returns"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["ok",(0,r.jsx)(n.br,{}),"\n","Boolean. ",(0,r.jsx)(n.code,{children:"true"})," on success, ",(0,r.jsx)(n.code,{children:"false"})," on failure."]}),"\n",(0,r.jsxs)(n.li,{children:["old_value_or_err",(0,r.jsx)(n.br,{}),"\n","String or ",(0,r.jsx)(n.code,{children:"nil"}),". Previous value at the destination (or ",(0,r.jsx)(n.code,{children:"nil"})," when absent); on failure it usually contains an error description, but missing source keys do not guarantee a fixed message."]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"notes",children:"Notes"}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsxs)(n.p,{children:["Atomically transfers the key from the source dictionary to the destination.",(0,r.jsx)(n.br,{}),"\n","When source and destination are identical, the function raises an error.",(0,r.jsx)(n.br,{}),"\n","A successful move with no previous destination value yields ",(0,r.jsx)(n.code,{children:"true, nil"}),".\nMissing source keys return ",(0,r.jsx)(n.code,{children:"false"}),", and the second return value does not guarantee a fixed message."]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-lua",children:'local ok, old = LCC.kvdb.dict.move_value("pending", "task#1", "running", "task#1")\nif not ok then\n    error(old)\nend\n'})})]})}function u(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(c,{...e})}):c(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>i,x:()=>a});var s=t(6540);const r={},o=s.createContext(r);function i(e){const n=s.useContext(o);return s.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(r):e.components||r:i(e.components),s.createElement(o.Provider,{value:n},e.children)}}}]);