aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua_api.c
diff options
context:
space:
mode:
authorGravatar BanceDev 2024-09-10 16:22:50 -0400
committerGravatar BanceDev 2024-09-10 16:22:50 -0400
commit838968626691d1d84d903ed53815de561cdf853b (patch)
treef6b53d7f8cd206d3695b87a7f48edb2aa943ece4 /src/lua_api.c
parentremoved demo image to cleanup (diff)
made it so that lua args properly reset between commands
Diffstat (limited to 'src/lua_api.c')
-rw-r--r--src/lua_api.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lua_api.c b/src/lua_api.c
index 93fee31..f58fba7 100644
--- a/src/lua_api.c
+++ b/src/lua_api.c
@@ -78,6 +78,10 @@ void lua_load_script(lua_State *L, const char *script, char **args) {
fprintf(stderr, "[C] Error loading script: %s\n", error_msg);
lua_pop(L, 1); // remove error from stack
}
+
+ // reset args after running or just keep it nil
+ lua_pushnil(L);
+ lua_setglobal(L, "args");
}
void lua_run_init(lua_State *L) {