Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update #270

Merged
merged 2 commits into from
Oct 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ static lua_State* vm_acquire(){
lua_pushcfunction(L, luaopen_luv);
lua_call(L, 0, 1);
lua_setfield(L, -2, "uv");

// remove package.loaded
lua_remove(L, -1);

Expand All @@ -97,6 +97,8 @@ static lua_State* vm_acquire(){

#ifdef WITH_PCRE
lua_pushcfunction(L, luaopen_rex_pcre);
lua_pushvalue(L, -1);
lua_setfield(L, -3, "rex_pcre");
lua_setfield(L, -2, "rex");
#endif

Expand Down Expand Up @@ -152,15 +154,14 @@ int main(int argc, char* argv[] ) {
// Hooks in libuv that need to be done in main.
argv = uv_setup_args(argc, argv);

luv_set_thread_cb(vm_acquire, vm_release);
// Create the lua state.
L = vm_acquire();
if (L == NULL) {
fprintf(stderr, "luaL_newstate has failed\n");
return 1;
}

luv_set_thread_cb(vm_acquire, vm_release);

#ifdef WITH_WINSVC
// Store luvi module definition at preload.openssl
lua_pushcfunction(L, luaopen_winsvc);
Expand Down