fix issues in LuaJIT builtin library
This commit is contained in:
parent
1b6b2435ed
commit
6ad8eb6230
@ -188,7 +188,7 @@ void PushVector(lua_State* L, const nf7::Value::ConstVector& v) noexcept {
|
||||
if (lua_istable(L, -1)) { // array
|
||||
lua_rawgeti(L, -1, 1);
|
||||
const std::string_view type = luaL_checkstring(L, -1);
|
||||
lua_rawgeti(L, -1, 2);
|
||||
lua_rawgeti(L, -2, 2);
|
||||
const size_t n = static_cast<size_t>(luaL_checkinteger(L, -1));
|
||||
lua_pop(L, 2);
|
||||
|
||||
@ -553,6 +553,7 @@ static size_t PushArrayFromBytes(lua_State* L, size_t n, const uint8_t* ptr, con
|
||||
[] <bool F = false>() { static_assert(F, "T is invalid"); }();
|
||||
}
|
||||
lua_rawseti(L, -2, static_cast<int>(i + 1));
|
||||
ptr += sizeof(T);
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user