mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-05 17:30:27 +00:00
Fix redbean's Lua-function Log, so it can be used in the global scope.
Before this fix Log crashed the redbean when Log was used in the global scope. The demo versions of redbean has a Log in a main function, therefore it didn't crash. Lua doesn't need a main function and every other redbean Lua-function can also be used in the most outer scope.
This commit is contained in:
parent
6bbb44c165
commit
cbc9ec92df
1 changed files with 1 additions and 1 deletions
|
@ -4911,7 +4911,7 @@ static int LuaLog(lua_State *L) {
|
|||
level = luaL_checkinteger(L, 1);
|
||||
if (LOGGABLE(level)) {
|
||||
msg = luaL_checkstring(L, 2);
|
||||
lua_getstack(L, 1, &ar);
|
||||
lua_getstack(L, 0, &ar);
|
||||
lua_getinfo(L, "nSl", &ar);
|
||||
if (!strcmp(ar.name, "main")) {
|
||||
module = strndup(effectivepath.p, effectivepath.n);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue