fix issues in LuaJIT builtin library

This commit is contained in:
2022-08-28 16:12:57 +09:00
parent 1b6b2435ed
commit 6ad8eb6230
2 changed files with 7 additions and 2 deletions

View File

@@ -204,7 +204,11 @@ static void PushMeta(lua_State* L) noexcept {
const int n = lua_gettop(L);
std::stringstream st;
for (int i = 2; i <= n; ++i) {
st << lua_tostring(L, i);
if (auto msg = lua_tostring(L, i)) {
st << msg;
} else {
return luaL_error(L, "cannot stringify %s", luaL_typename(L, i));
}
}
logger->Write({lv, st.str()});
return 0;