diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2022-12-07 15:12:52 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2022-12-07 15:12:52 -0300 |
commit | d738c8d18bcc5651109b3a46103d6aa983772e68 (patch) | |
tree | e66f2f38d7cc1600da3ea19b134c7c21636a3870 /lua.c | |
parent | 0270c204c235a495ce4702ac3891eb30752d0c8d (diff) | |
download | lua-d738c8d18bcc5651109b3a46103d6aa983772e68.tar.gz lua-d738c8d18bcc5651109b3a46103d6aa983772e68.tar.bz2 lua-d738c8d18bcc5651109b3a46103d6aa983772e68.zip |
New function 'luaL_openselectedlibs'
Makes it easier to start Lua with only some standard libraries.
Diffstat (limited to 'lua.c')
-rw-r--r-- | lua.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -609,6 +609,10 @@ static void doREPL (lua_State *L) { | |||
609 | 609 | ||
610 | /* }================================================================== */ | 610 | /* }================================================================== */ |
611 | 611 | ||
612 | #if !defined(luai_openlibs) | ||
613 | #define luai_openlibs(L) luaL_openlibs(L) | ||
614 | #endif | ||
615 | |||
612 | 616 | ||
613 | /* | 617 | /* |
614 | ** Main body of stand-alone interpreter (to be called in protected mode). | 618 | ** Main body of stand-alone interpreter (to be called in protected mode). |
@@ -631,7 +635,7 @@ static int pmain (lua_State *L) { | |||
631 | lua_pushboolean(L, 1); /* signal for libraries to ignore env. vars. */ | 635 | lua_pushboolean(L, 1); /* signal for libraries to ignore env. vars. */ |
632 | lua_setfield(L, LUA_REGISTRYINDEX, "LUA_NOENV"); | 636 | lua_setfield(L, LUA_REGISTRYINDEX, "LUA_NOENV"); |
633 | } | 637 | } |
634 | luaL_openlibs(L); /* open standard libraries */ | 638 | luai_openlibs(L); /* open standard libraries */ |
635 | createargtable(L, argv, argc, script); /* create table 'arg' */ | 639 | createargtable(L, argv, argc, script); /* create table 'arg' */ |
636 | lua_gc(L, LUA_GCRESTART); /* start GC... */ | 640 | lua_gc(L, LUA_GCRESTART); /* start GC... */ |
637 | lua_gc(L, LUA_GCGEN, 0, 0); /* ...in generational mode */ | 641 | lua_gc(L, LUA_GCGEN, 0, 0); /* ...in generational mode */ |