stop loading libraries after app code
This whole approach of disallowing overriding is suspect.
This commit is contained in:
parent
dd8730920a
commit
2d393bfb80
|
@ -213,7 +213,6 @@ static int pmain (lua_State *L) {
|
|||
globalL = L;
|
||||
if (argv[0] && argv[0][0]) progname = argv[0];
|
||||
|
||||
/* Libraries that can be over-ridden */
|
||||
lua_gc(L, LUA_GCSTOP, 0); /* stop collector during initialization */
|
||||
luaL_openlibs(L);
|
||||
status = dorequire(L, "src/lcurses/curses.lua", "curses");
|
||||
|
@ -240,6 +239,8 @@ static int pmain (lua_State *L) {
|
|||
if (status != 0) return 0;
|
||||
status = dorequire(L, "src/task.lua", "task");
|
||||
if (status != 0) return 0;
|
||||
status = dorequire(L, "src/file.lua", "file");
|
||||
if (status != 0) return 0;
|
||||
lua_gc(L, LUA_GCRESTART, 0);
|
||||
|
||||
s->status = handle_luainit(L);
|
||||
|
@ -247,12 +248,6 @@ static int pmain (lua_State *L) {
|
|||
s->status = load_image(L, argv, 1);
|
||||
if (s->status != 0) return 0;
|
||||
|
||||
/* Security-sensitive libraries that cannot be over-ridden */
|
||||
/* As a rule of thumb, if we ever special-case any Lua function names in C
|
||||
* code, that's a signal it needs to load after the app. */
|
||||
status = dorequire(L, "src/file.lua", "file"); /* special-cased in io_open */
|
||||
if (status != 0) return 0;
|
||||
|
||||
/* call main() */
|
||||
lua_getglobal(L, "spawn_main");
|
||||
s->status = docall(L, 0, 1);
|
||||
|
|
Loading…
Reference in New Issue