"use strict";(self.webpackChunkdocs_site=self.webpackChunkdocs_site||[]).push([[1201],{1210:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>i,contentTitle:()=>l,default:()=>u,frontMatter:()=>c,metadata:()=>o,toc:()=>a});const o=JSON.parse('{"id":"XXTLanControl.lua/core/connect","title":"Connect To The Controller (LCC.connect)","description":"Signature","source":"@site/i18n/en/docusaurus-plugin-content-docs/current/XXTLanControl.lua/core/connect.md","sourceDirName":"XXTLanControl.lua/core","slug":"/XXTLanControl.lua/core/connect","permalink":"/docs/en/XXTLanControl.lua/core/connect","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":40,"frontMatter":{"sidebar_position":40},"sidebar":"tutorialSidebar","previous":{"title":"Set Log Column Aliases (LCC.set_log_aliases)","permalink":"/docs/en/XXTLanControl.lua/core/set_log_aliases"},"next":{"title":"Read Script UI Configuration (LCC.get_ui_config)","permalink":"/docs/en/XXTLanControl.lua/core/get_ui_config"}}');var r=t(4848),s=t(8453);const c={sidebar_position:40},l="Connect To The Controller (LCC.connect)",i={},a=[{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 d(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,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.header,{children:(0,r.jsx)(n.h1,{id:"connect-to-the-controller-lccconnect",children:"Connect To The Controller (LCC.connect)"})}),"\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 = LCC.connect()\n"})}),"\n",(0,r.jsx)(n.h2,{id:"parameters",children:"Parameters"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"none"}),"\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. Returns ",(0,r.jsx)(n.code,{children:"true"})," when the connection and version check succeed; otherwise ",(0,r.jsx)(n.code,{children:"false"}),"."]}),"\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:["Loads configuration, completes initialisation, and reports the script state to the controller.",(0,r.jsx)(n.br,{}),"\n","If the module version mismatches, it shows a prompt, downloads the latest ",(0,r.jsx)(n.code,{children:"LCC.lua"}),", and hot-updates automatically.",(0,r.jsx)(n.br,{}),"\n","On success caches the config and registers an exit callback to report ",(0,r.jsx)(n.code,{children:"is_running = false"})," when the script terminates.",(0,r.jsx)(n.br,{}),"\n","When no address was set via ",(0,r.jsx)(n.code,{children:"LCC.set_api_url()"})," and the script is not launched by the controller, the function returns ",(0,r.jsx)(n.code,{children:"false"})," immediately."]}),"\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:'if not LCC.connect() then\n    error("Unable to connect to the controller")\nend\n'})})]})}function u(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>c,x:()=>l});var o=t(6540);const r={},s=o.createContext(r);function c(e){const n=o.useContext(s);return o.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:c(e.components),o.createElement(s.Provider,{value:n},e.children)}}}]);