Lua: Add luatemplates

Change-Id: Icc9e7505156eb8749da64e1f4022f27a57018a67
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Marcus Tillmanns
2024-04-12 14:40:21 +02:00
parent caf31c4fe9
commit 0543085a64
9 changed files with 527 additions and 3 deletions

View File

@@ -55,6 +55,17 @@ public:
static sol::table toTable(const sol::state_view &lua, const QJsonValue &v);
static QJsonValue toJson(const sol::table &t);
template<class T>
static void checkKey(const sol::table &table, const QString &key)
{
if (table[key].template is<T>())
return;
if (!table[key].valid())
throw sol::error("Expected " + key.toStdString() + " to be defined");
throw sol::error(
"Expected " + key.toStdString() + " to be of type " + sol::detail::demangle<T>());
}
static QStringList variadicToStringList(const sol::variadic_args &vargs);
template<typename R, typename... Args>