跳到主要内容

检查路径是否存在 (LCC.web_file.exists)

声明

type_or_false = LCC.web_file.exists(path, timeout?)

参数

  • path
    字符串型,要检查的文件或目录路径
  • timeout
    数值型,可选;请求超时时间(秒),默认 60

返回值

  • type_or_false
    字符串型或布尔型,存在时返回 "file""directory",不存在时返回 false

说明

检测路径是否存在及其类型。
不会抛出错误;网络失败时同样返回 false

示例

local typ = LCC.web_file.exists("/脚本/main.lua")
if typ == "file" then
print("找到脚本")
end