From d738c8d18bcc5651109b3a46103d6aa983772e68 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 7 Dec 2022 15:12:52 -0300 Subject: New function 'luaL_openselectedlibs' Makes it easier to start Lua with only some standard libraries. --- lua.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lua.c') diff --git a/lua.c b/lua.c index 715430a0..af20754e 100644 --- a/lua.c +++ b/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 */ -- cgit v1.2.3-55-g6feb