diff options
Diffstat (limited to 'src/lua_state.c')
| -rw-r--r-- | src/lua_state.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/lua_state.c b/src/lua_state.c index 297a218..cf46760 100644 --- a/src/lua_state.c +++ b/src/lua_state.c @@ -62,6 +62,8 @@ bool init_lua_state(void) { } str_free(&lua_path); + lua_setglobal(L, "__pkgit_user_config"); + lua_pop(L, 1); L_is_loaded = true; return true; } @@ -94,10 +96,8 @@ static void setup_base_dirs(void) { } static bool load_init_lua(void) { - lua_setglobal(L, "__PkgitUserConfig"); - lua_getglobal(L, "__PkgitUserConfig"); - - lua_get_field_type("dirs", table, &config.init_path, 1); + lua_getglobal(L, "__pkgit_user_config"); + lua_get_field_type("dirs", table, &config.init_path, 2); #define X(field) \ do { \ @@ -114,20 +114,15 @@ static bool load_init_lua(void) { #undef X - lua_pop(L, 1); + lua_pop(L, 2); return true; } bool init_lua_config(void) { setup_base_dirs(); - - if (!init_lua_state()) - return false; - - if (!load_init_lua()) - return false; - + if (!init_lua_state()) return false; + if (!load_init_lua()) return false; return true; } |
