From 838968626691d1d84d903ed53815de561cdf853b Mon Sep 17 00:00:00 2001 From: BanceDev Date: Tue, 10 Sep 2024 16:22:50 -0400 Subject: made it so that lua args properly reset between commands --- src/lua_api.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/lua_api.c') 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) { -- cgit v1.2.3-59-g8ed1b