aboutsummaryrefslogtreecommitdiffstats
path: root/.lush/scripts/example.lua
diff options
context:
space:
mode:
Diffstat (limited to '.lush/scripts/example.lua')
-rw-r--r--.lush/scripts/example.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/.lush/scripts/example.lua b/.lush/scripts/example.lua
index 9cf3c96..ffd04c1 100644
--- a/.lush/scripts/example.lua
+++ b/.lush/scripts/example.lua
@@ -23,6 +23,15 @@ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
print("Welcome to Lunar Shell scripting")
+-- command line args can be passed to lua programs
+-- done like so: example.lua arg1 arg2 ...
+-- args can be read using the global args tables
+if args ~= nil then
+ for i = 1, #args do
+ print(args[i])
+ end
+end
+
-- exec can be used to run any command line prompt
-- this method is much more native than using os.execute and is the recommended function
-- it also returns a boolean on if the command executed successfully