mirror of
https://gitlab.com/Syping/luaengineapp.git
synced 2024-11-04 21:16:56 +01:00
remove itoa
This commit is contained in:
parent
8078722293
commit
1f0737a981
1 changed files with 3 additions and 4 deletions
|
@ -19,7 +19,6 @@
|
|||
#include "LuaEngine.h"
|
||||
#include <QTextStream>
|
||||
#include <QMetaMethod>
|
||||
#include <QtGlobal>
|
||||
|
||||
LuaEngine::LuaEngine(QObject *parent, bool loadBaseLibraries) : QObject(parent)
|
||||
{
|
||||
|
@ -242,7 +241,7 @@ void LuaEngine::pushVariant(const QVariant &variant)
|
|||
void LuaEngine::pushVariant(lua_State *L_p, const QVariant &variant)
|
||||
{
|
||||
if (variant.type() == QVariant::Bool) {
|
||||
lua_pushboolean(L_p, variant.toBool());
|
||||
lua_pushboolean(L_p, (int)variant.toBool());
|
||||
}
|
||||
else if (variant.type() == QVariant::Int) {
|
||||
lua_pushinteger(L_p, variant.toInt());
|
||||
|
@ -259,7 +258,7 @@ void LuaEngine::pushVariant(lua_State *L_p, const QVariant &variant)
|
|||
int currentId = 1;
|
||||
for (const QString &string : stringList) {
|
||||
char buffer[65];
|
||||
itoa(currentId, buffer, 10);
|
||||
snprintf(buffer, 10, "%d", currentId);
|
||||
lua_pushstring(L_p, string.toUtf8().data());
|
||||
lua_setfield(L_p, -2, buffer);
|
||||
currentId++;
|
||||
|
@ -271,7 +270,7 @@ void LuaEngine::pushVariant(lua_State *L_p, const QVariant &variant)
|
|||
int currentId = 1;
|
||||
for (const QVariant &variant : variantList) {
|
||||
char buffer[65];
|
||||
itoa(currentId, buffer, 10);
|
||||
snprintf(buffer, 10, "%d", currentId);
|
||||
pushVariant(L_p, variant);
|
||||
lua_setfield(L_p, -2, buffer);
|
||||
currentId++;
|
||||
|
|
Loading…
Reference in a new issue