mirror of
https://gitlab.com/Syping/luaengineapp.git
synced 2025-09-06 08:52:05 +02:00
fix tables, getDirectoryContent replaces directoyListFiles
This commit is contained in:
parent
1f0737a981
commit
96f0511b0f
4 changed files with 82 additions and 26 deletions
|
@ -257,10 +257,9 @@ void LuaEngine::pushVariant(lua_State *L_p, const QVariant &variant)
|
|||
lua_createtable(L_p, 0, stringList.count());
|
||||
int currentId = 1;
|
||||
for (const QString &string : stringList) {
|
||||
char buffer[65];
|
||||
snprintf(buffer, 10, "%d", currentId);
|
||||
lua_pushinteger(L_p, currentId);
|
||||
lua_pushstring(L_p, string.toUtf8().data());
|
||||
lua_setfield(L_p, -2, buffer);
|
||||
lua_settable(L_p, -3);
|
||||
currentId++;
|
||||
}
|
||||
}
|
||||
|
@ -269,10 +268,9 @@ void LuaEngine::pushVariant(lua_State *L_p, const QVariant &variant)
|
|||
lua_createtable(L_p, 0, variantList.count());
|
||||
int currentId = 1;
|
||||
for (const QVariant &variant : variantList) {
|
||||
char buffer[65];
|
||||
snprintf(buffer, 10, "%d", currentId);
|
||||
lua_pushinteger(L_p, currentId);
|
||||
pushVariant(L_p, variant);
|
||||
lua_setfield(L_p, -2, buffer);
|
||||
lua_settable(L_p, -3);
|
||||
currentId++;
|
||||
}
|
||||
}
|
||||
|
@ -282,8 +280,9 @@ void LuaEngine::pushVariant(lua_State *L_p, const QVariant &variant)
|
|||
QVariantMap::const_iterator it = variantMap.constBegin();
|
||||
QVariantMap::const_iterator end = variantMap.constEnd();
|
||||
while (it != end) {
|
||||
lua_pushstring(L_p, it.key().toUtf8().data());
|
||||
pushVariant(L_p, it.value());
|
||||
lua_setfield(L_p, -2, it.key().toUtf8().data());
|
||||
lua_settable(L_p, -3);
|
||||
it++;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue