Fix redbean Log() in global scope (#230)

This commit is contained in:
w13b3 2021-08-08 00:28:32 +00:00 committed by Justine Tunney
parent 4daafef63a
commit d8faadf44e

View file

@ -4911,7 +4911,7 @@ static int LuaLog(lua_State *L) {
level = luaL_checkinteger(L, 1); level = luaL_checkinteger(L, 1);
if (LOGGABLE(level)) { if (LOGGABLE(level)) {
msg = luaL_checkstring(L, 2); msg = luaL_checkstring(L, 2);
lua_getstack(L, 1, &ar); lua_getstack(L, 0, &ar);
lua_getinfo(L, "nSl", &ar); lua_getinfo(L, "nSl", &ar);
if (!strcmp(ar.name, "main")) { if (!strcmp(ar.name, "main")) {
module = strndup(effectivepath.p, effectivepath.n); module = strndup(effectivepath.p, effectivepath.n);