LuaPosix: Difference between revisions
(→access) |
|||
Line 6: | Line 6: | ||
==access== | ==access== | ||
'''INPUT''' | |||
*Path- file or directory path that wants to be checked | |||
*Permission - what permissions do you want to check | |||
** "r" = read | |||
** "w" = write | |||
** "x" = execute | |||
** "f" = | |||
'''OUPUT''' | |||
*string - 0 for success, nil for failure if done | |||
bar = require "posix" | |||
temp = bar.access("/etc/passwd", "w") | |||
print(temp) | |||
Will give more information like | |||
bar = require "posix" | |||
print(bar.access("/etc/passwd", "w")) | |||
--If nil will give back the error too | |||
nil /etc/passwd: Permission denied 13 | |||
==chdir== | ==chdir== |
Revision as of 16:22, 9 November 2007
Lua Posix
This is a list of the Lua Posix functions. Included is helpful snipets of code. Install lua posix. To get this list do:
bar = require "posix" for a in pairs(bar) do print(a) end
access
INPUT
- Path- file or directory path that wants to be checked
- Permission - what permissions do you want to check
- "r" = read
- "w" = write
- "x" = execute
- "f" =
OUPUT
- string - 0 for success, nil for failure if done
bar = require "posix" temp = bar.access("/etc/passwd", "w") print(temp)
Will give more information like
bar = require "posix" print(bar.access("/etc/passwd", "w")) --If nil will give back the error too nil /etc/passwd: Permission denied 13
chdir
chmod
chown
ctermid
dir
errno
exec
files
fork
getcwd
getenv
getgroup
getlogin
getpassword
getprocessid
kill
link
mkdir
mkfifo
patchconf
putenv
readlink
rmdir
setgid
setuid
sleep
stat
symlink
sysconf
times
ttyname
umask
uname
utime
wait
If you are using this under linux also get