New function 'luaL_openselectedlibs'
Makes it easier to start Lua with only some standard libraries.
This commit is contained in:
6
lua.c
6
lua.c
@@ -609,6 +609,10 @@ static void doREPL (lua_State *L) {
|
||||
|
||||
/* }================================================================== */
|
||||
|
||||
#if !defined(luai_openlibs)
|
||||
#define luai_openlibs(L) luaL_openlibs(L)
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
** Main body of stand-alone interpreter (to be called in protected mode).
|
||||
@@ -631,7 +635,7 @@ static int pmain (lua_State *L) {
|
||||
lua_pushboolean(L, 1); /* signal for libraries to ignore env. vars. */
|
||||
lua_setfield(L, LUA_REGISTRYINDEX, "LUA_NOENV");
|
||||
}
|
||||
luaL_openlibs(L); /* open standard libraries */
|
||||
luai_openlibs(L); /* open standard libraries */
|
||||
createargtable(L, argv, argc, script); /* create table 'arg' */
|
||||
lua_gc(L, LUA_GCRESTART); /* start GC... */
|
||||
lua_gc(L, LUA_GCGEN, 0, 0); /* ...in generational mode */
|
||||
|
||||
Reference in New Issue
Block a user