Lua does not provide a natively way to change the permission of a file. Adding this function will enable flua scripts to access and modify (by using a temp file with right permission, then overwritting) protected files.
usage: > require'posix.sys.stat'.chmod('hello'.txt, 511)
0 -- example if success
nil No such file or directory 2 -- example if failure