diff options
Diffstat (limited to 'vis-lua.c')
| -rw-r--r-- | vis-lua.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -2097,6 +2097,10 @@ static const struct luaL_Reg window_selection_funcs[] = { * File state. * @tfield bool modified whether the file contains unsaved changes */ +/*** + * File permission. + * @tfield int permission the file permission bits as of the most recent load/save + */ static int file_index(lua_State *L) { File *file = obj_ref_check(L, 1, VIS_LUA_TYPE_FILE); @@ -2126,6 +2130,12 @@ static int file_index(lua_State *L) { lua_pushboolean(L, text_modified(file->text)); return 1; } + + if (strcmp(key, "permission") == 0) { + struct stat stat = text_stat(file->text); + lua_pushunsigned(L, stat.st_mode & 0777); + return 1; + } } return index_common(L); |
