From 0381ae7467e992f77ee7163402d97e2e14557398 Mon Sep 17 00:00:00 2001 From: BanceDev Date: Wed, 11 Sep 2024 15:42:49 -0400 Subject: added glob function to lua APi --- .lush/scripts/example.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to '.lush/scripts/example.lua') 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 -- cgit v1.2.3-59-g8ed1b