Lua: Cleanup code style

Change-Id: I7d8713c87a097f113c5b9d04104f3948b691dbf9
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
Marcus Tillmanns
2024-04-23 08:32:50 +02:00
parent fa41cba5c3
commit bc5b67909c

View File

@@ -137,8 +137,8 @@ expected_str<LuaPluginSpec *> LuaEngine::loadPlugin(const Utils::FilePath &path)
bool LuaEngine::isCoroutine(lua_State *state) bool LuaEngine::isCoroutine(lua_State *state)
{ {
bool ismain = lua_pushthread(state) == 1; bool ismain = lua_pushthread(state) == 1;
return !ismain; return !ismain;
} }
template<typename KeyType> template<typename KeyType>
@@ -162,16 +162,12 @@ sol::table LuaEngine::toTable(const sol::state_view &lua, const QJsonValue &v)
if (v.isObject()) { if (v.isObject()) {
QJsonObject o = v.toObject(); QJsonObject o = v.toObject();
for (auto it = o.constBegin(); it != o.constEnd(); ++it)
for (auto it = o.constBegin(); it != o.constEnd(); ++it) { setFromJson(table, it.key(), it.value());
setFromJson(table, it.key().toStdString(), it.value());
}
} else if (v.isArray()) { } else if (v.isArray()) {
int i = 1; int i = 1;
for (const auto &v : v.toArray()) { for (const auto &v : v.toArray())
setFromJson(table, i++, v); setFromJson(table, i++, v);
}
} }
return table; return table;