aboutsummaryrefslogtreecommitdiffstats
path: root/.lush
diff options
context:
space:
mode:
authorGravatar BanceDev 2024-09-11 15:42:49 -0400
committerGravatar BanceDev 2024-09-11 15:42:49 -0400
commit0381ae7467e992f77ee7163402d97e2e14557398 (patch)
treec391d22aca47aa7f153878ae1f8b3d2445afa43a /.lush
parentv0.1.0 (diff)
added glob function to lua APi
Diffstat (limited to '.lush')
-rw-r--r--.lush/scripts/example.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/.lush/scripts/example.lua b/.lush/scripts/example.lua
index 0239500..b3de3cb 100644
--- a/.lush/scripts/example.lua
+++ b/.lush/scripts/example.lua
@@ -96,3 +96,13 @@ lush.unsetenv("EXAMPLE")
-- this function is very useful if you want to make certain kinds of custom prompts in your init.lua
print("Terminal Columns: " .. lush.termCols())
print("Terminal Rows: " .. lush.termRows())
+
+-- the glob function scans the current working directory for files with the given extension and returns
+-- them as an array of strings
+local textFiles = lush.glob("txt")
+if textFiles ~= nil then
+ print("Printing txt files:")
+ for i = 1, #textFiles do
+ print(textFiles[i])
+ end
+end