aboutsummaryrefslogtreecommitdiffstats
path: root/src/lush.c
diff options
context:
space:
mode:
authorGravatar BanceDev 2024-09-08 12:41:18 -0400
committerGravatar BanceDev 2024-09-08 12:41:18 -0400
commitea0eb66096ddc62758d613e9eae84b9d8b3061dc (patch)
tree9be2d6cbda389d174554d05481797a2b107ac0f4 /src/lush.c
parentadded --version flag (diff)
added support for cli args for lua scripts
Diffstat (limited to 'src/lush.c')
-rw-r--r--src/lush.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lush.c b/src/lush.c
index 69aa055..a3fbb93 100644
--- a/src/lush.c
+++ b/src/lush.c
@@ -127,8 +127,14 @@ int lush_time(lua_State *L, char ***args) {
int lush_lua(lua_State *L, char ***args) {
// run the lua file given
- lua_load_script(L, args[0][0]);
+ const char *script = args[0][0];
+ // move args forward to any command line args
+ args[0]++;
+
+ lua_load_script(L, script, args[0]);
+ // return pointer back to lua file
+ args[0]--;
return 1;
}