How to check if a file is executable in Lua? -


how can check in lua if string path executable file? seems neither standard library nor, surprisingly, luafilesystem provides way this.

luafilesystem has lfs.attributes() function returns table. that, rather perversely, has key named "mode" contains string describing "type" of node (file, directory, socket, etc).

although it's not listed in manual at: http://keplerproject.github.io/luafilesystem/manual.html ... seems canonical reference module ... there 'permissions' key in table. think parse "x" characters.

i discovered with:

#!lua  local lfs = require 'lfs' attr = lfs.attributes('./some_file') name, value in pairs(attr)     print (name,value)     end 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -