Dear all,
I am trying to embed Lua for a sandbox scripting language, where all potentially harmful functions would be deactivated.
To do so, I patched the file "linit.c" and commented all lines of "loadedlibs" declaration:
static const luaL_Reg loadedlibs[] = {
// {"_G", luaopen_base},
// {LUA_LOADLIBNAME, luaopen_package},
// {LUA_COLIBNAME, luaopen_coroutine},
// {LUA_TABLIBNAME, luaopen_table},
// {LUA_IOLIBNAME, luaopen_io},
// {LUA_OSLIBNAME, luaopen_os},
// {LUA_STRLIBNAME, luaopen_string},
// {LUA_MATHLIBNAME, luaopen_math},
// {LUA_UTF8LIBNAME, luaopen_utf8},
// {LUA_DBLIBNAME, luaopen_debug},
#if defined(LUA_COMPAT_BITLIB)
// {LUA_BITLIBNAME, luaopen_bit32},
#endif
{NULL, NULL}
};
As a result, functions like 'io.open' are no more available. But I am a little puzzled because some functiosn declared in "luaopen_base", like "print" function, are still available.