aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/tools.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/tools.c b/src/tools.c
index ccd941d..ee2a1ca 100644
--- a/src/tools.c
+++ b/src/tools.c
@@ -446,8 +446,16 @@ lua_State* luaG_newstate( char const* libs, lua_CFunction _on_state_create)
446 } 446 }
447 if( libs) 447 if( libs)
448 { 448 {
449 lua_pushcfunction( L, luaopen_base); 449 if( libs[0] == '*' && libs[1] == 0) // special "*" case (mainly to help with LuaJIT compatibility)
450 lua_call( L, 0, 0); 450 {
451 luaL_openlibs( L);
452 libs = NULL; // done with libs
453 }
454 else
455 {
456 lua_pushcfunction( L, luaopen_base);
457 lua_call( L, 0, 0);
458 }
451 } 459 }
452 // after opening base, register the functions it exported in our name<->function database 460 // after opening base, register the functions it exported in our name<->function database
453 populate_func_lookup_table( L, LUA_GLOBALSINDEX, NULL); 461 populate_func_lookup_table( L, LUA_GLOBALSINDEX, NULL);