fix luatable in GetPlayerIdentifiers

This commit is contained in:
Lion Kortlepel 2021-07-03 00:58:19 +02:00
parent 261aa8f320
commit 7a3848e640
No known key found for this signature in database
GPG Key ID: 4322FF2B4C71259B

View File

@ -353,12 +353,13 @@ int lua_GetIdentifiers(lua_State* L) {
auto IDs = MaybeClient.value().lock()->GetIdentifiers(); auto IDs = MaybeClient.value().lock()->GetIdentifiers();
if (IDs.empty()) if (IDs.empty())
return 0; return 0;
lua_newtable(L); LuaTable::Begin(L);
for (const std::string& ID : IDs) { for (const std::string& ID : IDs) {
lua_pushstring(L, ID.substr(0, ID.find(':')).c_str()); LuaTable::BeginEntry(L, ID.substr(0, ID.find(':')).c_str());
lua_pushstring(L, ID.c_str()); lua_pushstring(L, ID.c_str());
lua_settable(L, -3); LuaTable::EndEntry(L);
} }
// LuaTable::End(L, "");
} else } else
return 0; return 0;
} else { } else {