"use strict";(self.webpackChunkdocs_site=self.webpackChunkdocs_site||[]).push([[542],{5855:(e,n,l)=>{l.r(n),l.d(n,{assets:()=>c,contentTitle:()=>o,default:()=>u,frontMatter:()=>r,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"XXTLanControl.lua/web-file/exists","title":"\u68c0\u67e5\u8def\u5f84\u662f\u5426\u5b58\u5728 (LCC.web_file.exists)","description":"\u58f0\u660e","source":"@site/docs/XXTLanControl.lua/web-file/exists.md","sourceDirName":"XXTLanControl.lua/web-file","slug":"/XXTLanControl.lua/web-file/exists","permalink":"/docs/XXTLanControl.lua/web-file/exists","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":40,"frontMatter":{"sidebar_position":40},"sidebar":"tutorialSidebar","previous":{"title":"\u5220\u9664\u4e2d\u63a7\u6587\u4ef6/\u76ee\u5f55 (LCC.web_file.delete)","permalink":"/docs/XXTLanControl.lua/web-file/delete"},"next":{"title":"\u83b7\u53d6\u8def\u5f84\u5c3a\u5bf8 (LCC.web_file.size)","permalink":"/docs/XXTLanControl.lua/web-file/size"}}');var i=l(4848),t=l(8453);const r={sidebar_position:40},o="\u68c0\u67e5\u8def\u5f84\u662f\u5426\u5b58\u5728 (LCC.web_file.exists)",c={},d=[{value:"\u58f0\u660e",id:"\u58f0\u660e",level:2},{value:"\u53c2\u6570",id:"\u53c2\u6570",level:2},{value:"\u8fd4\u56de\u503c",id:"\u8fd4\u56de\u503c",level:2},{value:"\u8bf4\u660e",id:"\u8bf4\u660e",level:2},{value:"\u793a\u4f8b",id:"\u793a\u4f8b",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,t.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.header,{children:(0,i.jsx)(n.h1,{id:"\u68c0\u67e5\u8def\u5f84\u662f\u5426\u5b58\u5728-lccweb_fileexists",children:"\u68c0\u67e5\u8def\u5f84\u662f\u5426\u5b58\u5728 (LCC.web_file.exists)"})}),"\n",(0,i.jsx)(n.h2,{id:"\u58f0\u660e",children:"\u58f0\u660e"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-lua",children:"type_or_false = LCC.web_file.exists(path, timeout?)\n"})}),"\n",(0,i.jsx)(n.h2,{id:"\u53c2\u6570",children:"\u53c2\u6570"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["path",(0,i.jsx)(n.br,{}),"\n","\u5b57\u7b26\u4e32\u578b\uff0c\u8981\u68c0\u67e5\u7684\u6587\u4ef6\u6216\u76ee\u5f55\u8def\u5f84"]}),"\n",(0,i.jsxs)(n.li,{children:["timeout",(0,i.jsx)(n.br,{}),"\n","\u6570\u503c\u578b\uff0c\u53ef\u9009\uff1b\u8bf7\u6c42\u8d85\u65f6\u65f6\u95f4\uff08\u79d2\uff09\uff0c\u9ed8\u8ba4 ",(0,i.jsx)(n.code,{children:"60"})]}),"\n"]}),"\n",(0,i.jsx)(n.h2,{id:"\u8fd4\u56de\u503c",children:"\u8fd4\u56de\u503c"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["type_or_false",(0,i.jsx)(n.br,{}),"\n","\u5b57\u7b26\u4e32\u578b\u6216\u5e03\u5c14\u578b\uff0c\u5b58\u5728\u65f6\u8fd4\u56de ",(0,i.jsx)(n.code,{children:'"file"'})," \u6216 ",(0,i.jsx)(n.code,{children:'"directory"'}),"\uff0c\u4e0d\u5b58\u5728\u65f6\u8fd4\u56de ",(0,i.jsx)(n.code,{children:"false"})]}),"\n"]}),"\n",(0,i.jsx)(n.h2,{id:"\u8bf4\u660e",children:"\u8bf4\u660e"}),"\n",(0,i.jsxs)(n.blockquote,{children:["\n",(0,i.jsxs)(n.p,{children:["\u68c0\u6d4b\u8def\u5f84\u662f\u5426\u5b58\u5728\u53ca\u5176\u7c7b\u578b\u3002",(0,i.jsx)(n.br,{}),"\n","\u4e0d\u4f1a\u629b\u51fa\u9519\u8bef\uff1b\u7f51\u7edc\u5931\u8d25\u65f6\u540c\u6837\u8fd4\u56de ",(0,i.jsx)(n.code,{children:"false"}),"\u3002"]}),"\n"]}),"\n",(0,i.jsx)(n.h2,{id:"\u793a\u4f8b",children:"\u793a\u4f8b"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-lua",children:'local typ = LCC.web_file.exists("/\u811a\u672c/main.lua")\nif typ == "file" then\n    print("\u627e\u5230\u811a\u672c")\nend\n'})})]})}function u(e={}){const{wrapper:n}={...(0,t.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(a,{...e})}):a(e)}},8453:(e,n,l)=>{l.d(n,{R:()=>r,x:()=>o});var s=l(6540);const i={},t=s.createContext(i);function r(e){const n=s.useContext(t);return s.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(i):e.components||i:r(e.components),s.createElement(t.Provider,{value:n},e.children)}}}]);