From c8cf765c782fd12344911af24ff23624cac02d0c Mon Sep 17 00:00:00 2001 From: benoit-germain Date: Thu, 26 Apr 2012 12:55:51 +0300 Subject: Improve LuaJIT compatibility, part #1: "*" library list is loaded through luaL_openlibs() --- src/tools.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') 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) } if( libs) { - lua_pushcfunction( L, luaopen_base); - lua_call( L, 0, 0); + if( libs[0] == '*' && libs[1] == 0) // special "*" case (mainly to help with LuaJIT compatibility) + { + luaL_openlibs( L); + libs = NULL; // done with libs + } + else + { + lua_pushcfunction( L, luaopen_base); + lua_call( L, 0, 0); + } } // after opening base, register the functions it exported in our name<->function database populate_func_lookup_table( L, LUA_GLOBALSINDEX, NULL); -- cgit v1.2.3-55-g6feb