diff options
Diffstat (limited to 'src/package.c')
| -rw-r--r-- | src/package.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/package.c b/src/package.c index 76216c7..2a947c0 100644 --- a/src/package.c +++ b/src/package.c @@ -167,7 +167,7 @@ int pow_extract_package_info(lua_State *L, pow_package *pkg) { return 0; } -int pow_package_open(pow_package *pkg, pow_config *cfg, const char *path) { +int pow_package_open(lua_State *L_global, pow_package *pkg, pow_config *cfg, const char *path) { FILE *fp; int c; int err; @@ -212,10 +212,12 @@ int pow_package_open(pow_package *pkg, pow_config *cfg, const char *path) { package_buffer[total] = '\0'; - lua_State *L = luaL_newstate(); + lua_State *L = lua_newthread(L_global); pkg->L = L; + // push the config object from cfg thread to pkg thread + luaL_openlibs(L); pow_lua_load(L, cfg); |
