diff options
-rw-r--r-- | docs/index.html | 7 | ||||
-rw-r--r-- | src/state.cpp | 6 |
2 files changed, 10 insertions, 3 deletions
diff --git a/docs/index.html b/docs/index.html index 47dc47c..92cc38a 100644 --- a/docs/index.html +++ b/docs/index.html | |||
@@ -500,14 +500,16 @@ | |||
500 | <table style="width:100%"> | 500 | <table style="width:100%"> |
501 | <tr> | 501 | <tr> |
502 | <td style="width:5%"></td> | 502 | <td style="width:5%"></td> |
503 | <td>(nothing)</td> | 503 | <td> |
504 | <tt>nil</tt> | ||
505 | </td> | ||
504 | <td style="width:5%"></td> | 506 | <td style="width:5%"></td> |
505 | <td>no standard libraries (default)</td> | 507 | <td>no standard libraries (default)</td> |
506 | </tr> | 508 | </tr> |
507 | <tr> | 509 | <tr> |
508 | <td /> | 510 | <td /> |
509 | <td> | 511 | <td> |
510 | <tt>"base"</tt> or <tt>""</tt> | 512 | <tt>"base"</tt> |
511 | </td> | 513 | </td> |
512 | <td /> | 514 | <td /> |
513 | <td> | 515 | <td> |
@@ -658,6 +660,7 @@ | |||
658 | </p> | 660 | </p> |
659 | 661 | ||
660 | <p> | 662 | <p> |
663 | Any non-<tt>nil</tt> value causes initialization of <tt>"base"</tt> and <tt>"jit"</tt> (the latter only for LuaJIT-based builds).<br/> | ||
661 | Initializing the standard libs takes a bit of time at each lane invocation. This is the main reason why "no libraries" is the default. | 664 | Initializing the standard libs takes a bit of time at each lane invocation. This is the main reason why "no libraries" is the default. |
662 | </p> | 665 | </p> |
663 | 666 | ||
diff --git a/src/state.cpp b/src/state.cpp index 83b9e85..08ed111 100644 --- a/src/state.cpp +++ b/src/state.cpp | |||
@@ -344,7 +344,7 @@ lua_State* luaG_newstate(Universe* U_, SourceState from_, char const* libs_) | |||
344 | // 'lua.c' stops GC during initialization so perhaps it is a good idea. :) | 344 | // 'lua.c' stops GC during initialization so perhaps it is a good idea. :) |
345 | lua_gc(_L, LUA_GCSTOP, 0); | 345 | lua_gc(_L, LUA_GCSTOP, 0); |
346 | 346 | ||
347 | // Anything causes 'base' to be taken in | 347 | // Anything causes 'base' and 'jit' to be taken in |
348 | if (libs_ != nullptr) { | 348 | if (libs_ != nullptr) { |
349 | // special "*" case (mainly to help with LuaJIT compatibility) | 349 | // special "*" case (mainly to help with LuaJIT compatibility) |
350 | // as we are called from luaopen_lanes_core() already, and that would deadlock | 350 | // as we are called from luaopen_lanes_core() already, and that would deadlock |
@@ -355,6 +355,10 @@ lua_State* luaG_newstate(Universe* U_, SourceState from_, char const* libs_) | |||
355 | open1lib(DEBUGSPEW_PARAM_COMMA(U_) _L, kLanesCoreLibName); | 355 | open1lib(DEBUGSPEW_PARAM_COMMA(U_) _L, kLanesCoreLibName); |
356 | libs_ = nullptr; // done with libs | 356 | libs_ = nullptr; // done with libs |
357 | } else { | 357 | } else { |
358 | #if LUAJIT_FLAVOR() != 0 // building against LuaJIT headers, always open jit | ||
359 | DEBUGSPEW_CODE(DebugSpew(U_) << "opening 'jit' library" << std::endl); | ||
360 | open1lib(DEBUGSPEW_PARAM_COMMA(U_) _L, LUA_JITLIBNAME); | ||
361 | #endif // LUAJIT_FLAVOR() | ||
358 | DEBUGSPEW_CODE(DebugSpew(U_) << "opening 'base' library" << std::endl); | 362 | DEBUGSPEW_CODE(DebugSpew(U_) << "opening 'base' library" << std::endl); |
359 | #if LUA_VERSION_NUM >= 502 | 363 | #if LUA_VERSION_NUM >= 502 |
360 | // open base library the same way as in luaL_openlibs() | 364 | // open base library the same way as in luaL_openlibs() |