"use strict";(self.webpackChunkdocs_site=self.webpackChunkdocs_site||[]).push([[3726],{5685:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>c,contentTitle:()=>o,default:()=>u,frontMatter:()=>s,metadata:()=>t,toc:()=>d});const t=JSON.parse('{"id":"XXTLanControl.lua/web-file/list","title":"List Files On The Controller (LCC.web_file.list)","description":"Signature","source":"@site/i18n/en/docusaurus-plugin-content-docs/current/XXTLanControl.lua/web-file/list.md","sourceDirName":"XXTLanControl.lua/web-file","slug":"/XXTLanControl.lua/web-file/list","permalink":"/docs/en/XXTLanControl.lua/web-file/list","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":10,"frontMatter":{"sidebar_position":10},"sidebar":"tutorialSidebar","previous":{"title":"Shared Files","permalink":"/docs/en/XXTLanControl.lua/web-file/"},"next":{"title":"Create A Controller Directory (LCC.web_file.mkdir)","permalink":"/docs/en/XXTLanControl.lua/web-file/mkdir"}}');var l=r(4848),i=r(8453);const s={sidebar_position:10},o="List Files On The Controller (LCC.web_file.list)",c={},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 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,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(n.header,{children:(0,l.jsx)(n.h1,{id:"list-files-on-the-controller-lccweb_filelist",children:"List Files On The Controller (LCC.web_file.list)"})}),"\n",(0,l.jsx)(n.h2,{id:"signature",children:"Signature"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-lua",children:"list, err = LCC.web_file.list(path, recursive?, timeout?)\n"})}),"\n",(0,l.jsx)(n.h2,{id:"parameters",children:"Parameters"}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsxs)(n.li,{children:["path",(0,l.jsx)(n.br,{}),"\n","String. Directory path on the controller to inspect."]}),"\n",(0,l.jsxs)(n.li,{children:["recursive",(0,l.jsx)(n.br,{}),"\n","Boolean, optional. When ",(0,l.jsx)(n.code,{children:"true"}),", lists subfolders recursively; default ",(0,l.jsx)(n.code,{children:"false"}),"."]}),"\n",(0,l.jsxs)(n.li,{children:["timeout",(0,l.jsx)(n.br,{}),"\n","Number, optional. Request timeout in seconds, default ",(0,l.jsx)(n.code,{children:"60"}),"."]}),"\n"]}),"\n",(0,l.jsx)(n.h2,{id:"returns",children:"Returns"}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsxs)(n.li,{children:["list",(0,l.jsx)(n.br,{}),"\n","Table. Array of file/directory descriptors from the controller; ",(0,l.jsx)(n.code,{children:"nil"})," on failure."]}),"\n",(0,l.jsxs)(n.li,{children:["err",(0,l.jsx)(n.br,{}),"\n","String or ",(0,l.jsx)(n.code,{children:"nil"}),". Error description when the call fails."]}),"\n"]}),"\n",(0,l.jsx)(n.h2,{id:"notes",children:"Notes"}),"\n",(0,l.jsxs)(n.blockquote,{children:["\n",(0,l.jsxs)(n.p,{children:["Lists files and subdirectories under the given path.",(0,l.jsx)(n.br,{}),"\n","Requires the controller address to be set or the script to be launched by the controller.",(0,l.jsx)(n.br,{}),"\n","Each entry includes ",(0,l.jsx)(n.code,{children:"name"}),", ",(0,l.jsx)(n.code,{children:"path"}),", ",(0,l.jsx)(n.code,{children:"dir"}),", ",(0,l.jsx)(n.code,{children:"symlink"}),", ",(0,l.jsx)(n.code,{children:"size"}),", and ",(0,l.jsx)(n.code,{children:"modification"}),".",(0,l.jsx)(n.br,{}),"\n",(0,l.jsx)(n.code,{children:"symlink"})," indicates whether the entry itself is a symlink; when the target is reachable, ",(0,l.jsx)(n.code,{children:"dir"})," and ",(0,l.jsx)(n.code,{children:"size"})," reflect the target state."]}),"\n"]}),"\n",(0,l.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-lua",children:'local nodes, err = LCC.web_file.list("/scripts", true)\nif not nodes then\n    error(err)\nend\n'})})]})}function u(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,l.jsx)(n,{...e,children:(0,l.jsx)(a,{...e})}):a(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>s,x:()=>o});var t=r(6540);const l={},i=t.createContext(l);function s(e){const n=t.useContext(i);return t.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(l):e.components||l:s(e.components),t.createElement(i.Provider,{value:n},e.children)}}}]);