Skip to content

Commit

Permalink
Fix #13110: [Script] convert table keys to string when generating JSO…
Browse files Browse the repository at this point in the history
…N (#13113)
  • Loading branch information
glx22 authored Nov 23, 2024
1 parent b890dab commit 681b192
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/script/api/script_admin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 681b192

Please sign in to comment.