在 Lua 中,可以使用 lua 函数 io.open() 来检查文件是否存在。如果文件存在,io.open() 将返回文件句柄;如果文件不存在,它将返回 nil。
代码示例:
local file = io.open("filename.lua", "r")
if file then
-- file exists
io.close(file)
-- file does not exist
beyond__devil
![]() |
深沉的伤疤 · js中如何停止或清除timeout定时任务操 ...· 1 年前 · |
![]() |
暴躁的稀饭 · window.open方法一次打开多个页面_ ...· 1 年前 · |
![]() |
乖乖的蘑菇 · 解决:avcodec_open2(c, ...· 1 年前 · |