Compare commits

...

2 Commits

Author SHA1 Message Date
6ad8eb6230 fix issues in LuaJIT builtin library 2022-08-28 16:12:57 +09:00
1b6b2435ed add nf7::DirItem flag to LuaJIT/InlineNode 2022-08-28 15:20:38 +09:00
3 changed files with 8 additions and 3 deletions

View File

@ -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;
}

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;

View File

@ -39,7 +39,7 @@ namespace {
class InlineNode final : public nf7::FileBase, public nf7::DirItem, public nf7::Node {
public:
static inline const nf7::GenericTypeInfo<InlineNode> kType =
{"LuaJIT/InlineNode", {"nf7::Node"}};
{"LuaJIT/InlineNode", {"nf7::DirItem", "nf7::Node"}};
static void UpdateTypeTooltip() noexcept {
ImGui::TextUnformatted("Defines new Node using Lua object factory.");
ImGui::Bullet();