"use strict";(self.webpackChunkdocs_site=self.webpackChunkdocs_site||[]).push([[3856],{8453:(e,s,t)=>{t.d(s,{R:()=>i,x:()=>l});var n=t(6540);const r={},a=n.createContext(r);function i(e){const s=n.useContext(a);return n.useMemo(function(){return"function"==typeof e?e(s):{...s,...e}},[s,e])}function l(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),n.createElement(a.Provider,{value:s},e.children)}},9933:(e,s,t)=>{t.r(s),t.d(s,{assets:()=>o,contentTitle:()=>l,default:()=>u,frontMatter:()=>i,metadata:()=>n,toc:()=>c});const n=JSON.parse('{"id":"XXTLanControl.lua/assist/request","title":"Create and Wait (LCC.assist.request)","description":"Declaration","source":"@site/i18n/en/docusaurus-plugin-content-docs/current/XXTLanControl.lua/assist/request.md","sourceDirName":"XXTLanControl.lua/assist","slug":"/XXTLanControl.lua/assist/request","permalink":"/docs/en/XXTLanControl.lua/assist/request","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":30,"frontMatter":{"sidebar_position":30},"sidebar":"tutorialSidebar","previous":{"title":"Wait for an Assist Result (LCC.assist.wait)","permalink":"/docs/en/XXTLanControl.lua/assist/wait"},"next":{"title":"Request a Text Reply (LCC.assist.ask_text)","permalink":"/docs/en/XXTLanControl.lua/assist/ask_text"}}');var r=t(4848),a=t(8453);const i={sidebar_position:30},l="Create and Wait (LCC.assist.request)",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={a:"a",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:"create-and-wait-lccassistrequest",children:"Create and Wait (LCC.assist.request)"})}),"\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.request(options)\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:["options",(0,r.jsx)(s.br,{}),"\n","Table. Assist request configuration. See ",(0,r.jsx)(s.a,{href:"/docs/en/XXTLanControl.lua/assist/common-options",children:"Common Options and Return Objects"}),"."]}),"\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"}),". The submitted result object on success."]}),"\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, such as ",(0,r.jsx)(s.code,{children:'"cancelled"'}),", ",(0,r.jsx)(s.code,{children:'"expired"'}),", or ",(0,r.jsx)(s.code,{children:'"timeout"'}),"."]}),"\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:[(0,r.jsx)(s.code,{children:"request()"})," calls ",(0,r.jsx)(s.code,{children:"LCC.assist.create(options)"})," to create the request, then calls ",(0,r.jsx)(s.code,{children:"LCC.assist.wait(task.id, options.timeout, options.pollIntervalMs)"})," to block until a result is available.",(0,r.jsx)(s.br,{}),"\n","In most scripts, prefer ",(0,r.jsx)(s.code,{children:"ask_text()"}),", ",(0,r.jsx)(s.code,{children:"pick_point()"}),", or ",(0,r.jsx)(s.code,{children:"request_control()"})," because they set the request type automatically.",(0,r.jsx)(s.br,{}),"\n","If the wait times out, the SDK cancels the request and returns ",(0,r.jsx)(s.code,{children:'nil, "timeout", task'}),"."]}),"\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.request({\n    type = "control",\n    title = "Handle verification",\n    text = "Remote-control the device, finish the current verification, then click Done",\n    timeout = 300,\n})\n\nif not result then\n    nLog("assist request not completed", 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)}}}]);