Browse Source

a sharp edge in Lua's dorequire()

You can't call it on a file that isn't a module, i.e. that doesn't
return something at the end. Use dofile() instead.
main
Kartik K. Agaram 3 months ago
parent
commit
e5b5a82970
  1. 2
      src/lua.c

2
src/lua.c

@ -239,7 +239,7 @@ 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");
status = dofile(L, "src/file.lua");
if (status != 0) return 0;
lua_gc(L, LUA_GCRESTART, 0);

Loading…
Cancel
Save