lights FAQ Forum github.com/luapower/unixperms
unixperms

Support APIs
opengl
luastate
lfrb WIP
eq
cbframe
heap
path
unixperms
lexer
dynasm

unixperms

UNIX permissions strings


local unixperms = require'unixperms'

unixperms.parse(s[, base]) -> mode, is_relative

Parse a unix permissions string and return its binary value. The string can be an octal number beginning with a '0', or a specification of form '[ugo]*[-+=]?[rwxsStT]+ ...'. is_relative is true if the permissions do not modify the entire mask of the base, eg. '+x' (i.e. 'ugo+x') says "add the execute bit for all" and it's thus a relative spec, while 'rx' (i.e. 'ugo=rx') says "set the read and execute bits for all" and it's thus an absolute spec. base defaults to 0. If s is not a string, s, false is returned.

unixperms.format(mode[, opt]) -> s

Format a unix permissions binary value to a string. opt can be 'l[ong]' (which turns 0555 into 'r-xr-xr-x') or 'o[ctal]' (which turns 0555 into '0555'). default is 'o'.


Last updated: 6 months ago | Edit on GitHub

Pkg type:Lua
Version: r1-2-g05c8213
Last commit:
License: PD
Requires: luajit 
Required by: none

Top