1
0
Fork 0

Fix #13110: [Script] convert table keys to string when generating JSON

pull/13113/head
glx22 2024-11-21 22:34:06 +01:00
parent 6d3adc6169
commit 8a24ae9545
1 changed files with 3 additions and 3 deletions

View File

@ -77,11 +77,11 @@ bool ScriptAdminMakeJSON(nlohmann::json &json, HSQUIRRELVM vm, SQInteger index,
sq_pushnull(vm);
while (SQ_SUCCEEDED(sq_next(vm, index - 1))) {
/* Squirrel ensure the key is a string. */
assert(sq_gettype(vm, -2) == OT_STRING);
sq_tostring(vm, -2);
const SQChar *buf;
sq_getstring(vm, -2, &buf);
sq_getstring(vm, -1, &buf);
std::string key = std::string(buf);
sq_pop(vm, 1);
nlohmann::json value;
bool res = ScriptAdminMakeJSON(value, vm, -1, depth + 1);