diff options
| author | 2024-09-04 16:39:14 -0400 | |
|---|---|---|
| committer | 2024-09-04 16:39:14 -0400 | |
| commit | 65d523bd0417d5cf9b9b20167ee5754eb7b5e791 (patch) | |
| tree | 5870d53c7c62f58bcb75ed09143575c8ee67525a /.lush/scripts/example.lua | |
| parent | command history scrolling implemented (diff) | |
added api functions for isFile, isDirectory, isReadable, and isWriteable
Diffstat (limited to '.lush/scripts/example.lua')
| -rw-r--r-- | .lush/scripts/example.lua | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/.lush/scripts/example.lua b/.lush/scripts/example.lua index 04cb516..9cf3c96 100644 --- a/.lush/scripts/example.lua +++ b/.lush/scripts/example.lua @@ -49,3 +49,20 @@ lush.cd(cwd) if lush.exists("~/.lush/scripts/example.lua") then print("example.lua exists") end + +-- isFile and isDir check if a path points to a file or a directory +if lush.isFile("~/.lush/scripts/example.lua") then + print("example.lua is a file") +end + +if not lush.isDirectory("~/.lush/scripts/example.lua") then + print("example.lua is not a directory") +end + +-- you can also check if a file is readable/writeable +if lush.isReadable("~/.lush/scripts/example.lua") then + print("example.lua is readable") +end +if lush.isWriteable("~/.lush/scripts/example.lua") then + print("example.lua is writeable") +end |
