Lua libraries cannot determine this by default.
However, you can use the third-party LuaFileSystem library to access more complex file system interactions; he is also cross-platform.
LuaFileSystem provides lfs.attributes that you can use to request file mode:
require "lfs" function is_dir(path) -- lfs.attributes will error on a filename ending in '/' return path:sub(-1) == "/" or lfs.attributes(path, "mode") == "directory" end
Amber source share