檢查路徑是否存在 (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