summaryrefslogtreecommitdiff
path: root/src/tools.c
diff options
context:
space:
mode:
authorbenoit-germain <bnt.germain@gmail.com>2012-04-26 12:55:51 +0300
committerbenoit-germain <bnt.germain@gmail.com>2012-04-26 12:55:51 +0300
commitc8cf765c782fd12344911af24ff23624cac02d0c (patch)
tree64bf41edf8272c14fe73c60c4d4685d931f67daa /src/tools.c
parent213dda9224f18c156bb94b2c6c054ce400a22bd0 (diff)
downloadlanes-c8cf765c782fd12344911af24ff23624cac02d0c.tar.gz
lanes-c8cf765c782fd12344911af24ff23624cac02d0c.tar.bz2
lanes-c8cf765c782fd12344911af24ff23624cac02d0c.zip
Improve LuaJIT compatibility, part #1: "*" library list is loaded through luaL_openlibs()
Diffstat (limited to 'src/tools.c')
-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);