"use strict";(self.webpackChunkdocs_site=self.webpackChunkdocs_site||[]).push([[1808],{1554:(e,s,t)=>{t.r(s),t.d(s,{assets:()=>o,contentTitle:()=>i,default:()=>u,frontMatter:()=>l,metadata:()=>n,toc:()=>c});const n=JSON.parse('{"id":"XXTLanControl.lua/assist/wait","title":"Wait for an Assist Result (LCC.assist.wait)","description":"Declaration","source":"@site/i18n/en/docusaurus-plugin-content-docs/current/XXTLanControl.lua/assist/wait.md","sourceDirName":"XXTLanControl.lua/assist","slug":"/XXTLanControl.lua/assist/wait","permalink":"/docs/en/XXTLanControl.lua/assist/wait","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":25,"frontMatter":{"sidebar_position":25},"sidebar":"tutorialSidebar","previous":{"title":"Create an Assist Request (LCC.assist.create)","permalink":"/docs/en/XXTLanControl.lua/assist/create"},"next":{"title":"Create and Wait (LCC.assist.request)","permalink":"/docs/en/XXTLanControl.lua/assist/request"}}');var r=t(4848),a=t(8453);const l={sidebar_position:25},i="Wait for an Assist Result (LCC.assist.wait)",o={},c=[{value:"Declaration",id:"declaration",level:2},{value:"Parameters",id:"parameters",level:2},{value:"Return Values",id:"return-values",level:2},{value:"Notes",id:"notes",level:2},{value:"Example",id:"example",level:2}];function d(e){const s={blockquote:"blockquote",br:"br",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",ul:"ul",...(0,a.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s.header,{children:(0,r.jsx)(s.h1,{id:"wait-for-an-assist-result-lccassistwait",children:"Wait for an Assist Result (LCC.assist.wait)"})}),"\n",(0,r.jsx)(s.h2,{id:"declaration",children:"Declaration"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-lua",children:"result, err, task = LCC.assist.wait(id, timeout?, pollIntervalMs?)\n"})}),"\n",(0,r.jsx)(s.h2,{id:"parameters",children:"Parameters"}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:["id",(0,r.jsx)(s.br,{}),"\n","String. Assist request ID."]}),"\n",(0,r.jsxs)(s.li,{children:["timeout",(0,r.jsx)(s.br,{}),"\n","Number, optional. Wait timeout in seconds. Defaults to ",(0,r.jsx)(s.code,{children:"300"}),"."]}),"\n",(0,r.jsxs)(s.li,{children:["pollIntervalMs",(0,r.jsx)(s.br,{}),"\n","Number, optional. Polling interval in milliseconds. Defaults to ",(0,r.jsx)(s.code,{children:"1000"}),"; values below ",(0,r.jsx)(s.code,{children:"250"})," are clamped to ",(0,r.jsx)(s.code,{children:"250"}),"."]}),"\n"]}),"\n",(0,r.jsx)(s.h2,{id:"return-values",children:"Return Values"}),"\n",(0,r.jsxs)(s.ul,{children:["\n",(0,r.jsxs)(s.li,{children:["result",(0,r.jsx)(s.br,{}),"\n","Table or ",(0,r.jsx)(s.code,{children:"nil"}),". Submitted result when the task reaches ",(0,r.jsx)(s.code,{children:"submitted"}),"."]}),"\n",(0,r.jsxs)(s.li,{children:["err",(0,r.jsx)(s.br,{}),"\n","String or ",(0,r.jsx)(s.code,{children:"nil"}),". Failure reason."]}),"\n",(0,r.jsxs)(s.li,{children:["task",(0,r.jsx)(s.br,{}),"\n","Table or ",(0,r.jsx)(s.code,{children:"nil"}),". The latest task state."]}),"\n"]}),"\n",(0,r.jsx)(s.h2,{id:"notes",children:"Notes"}),"\n",(0,r.jsxs)(s.blockquote,{children:["\n",(0,r.jsxs)(s.p,{children:["Polls the control center until the task is submitted, cancelled, expired, not found, or timed out locally.",(0,r.jsx)(s.br,{}),"\n","On local timeout, the SDK attempts to cancel the request and returns ",(0,r.jsx)(s.code,{children:'nil, "timeout", task'}),".",(0,r.jsx)(s.br,{}),"\n","Only ",(0,r.jsx)(s.code,{children:"submitted"})," returns a ",(0,r.jsx)(s.code,{children:"result"}),"."]}),"\n"]}),"\n",(0,r.jsx)(s.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(s.pre,{children:(0,r.jsx)(s.code,{className:"language-lua",children:'local result, err, task = LCC.assist.wait("assist_xxx", 300, 1000)\nif result then\n    nLog("assist completed")\nelse\n    nLog("assist failed", err, task and task.status)\nend\n'})})]})}function u(e={}){const{wrapper:s}={...(0,a.R)(),...e.components};return s?(0,r.jsx)(s,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,s,t)=>{t.d(s,{R:()=>l,x:()=>i});var n=t(6540);const r={},a=n.createContext(r);function l(e){const s=n.useContext(a);return n.useMemo(function(){return"function"==typeof e?e(s):{...s,...e}},[s,e])}function i(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:l(e.components),n.createElement(a.Provider,{value:s},e.children)}}}]);