MCPcopy Create free account
hub / github.com/OpenSteam001/OpenSteamTool / lua_setStat

Function lua_setStat

src/Utils/Config/LuaConfig.cpp:396–418  ·  view source on GitHub ↗

── Lua: setStat ────────────────────────────────────────────

Source from the content-addressed store, hash-verified

394
395 // ── Lua: setStat ────────────────────────────────────────────
396 static int lua_setStat(lua_State* L) {
397 // setStat(appid, "steamid")
398 int argc = lua_gettop(L);
399 if (argc < 2)
400 return luaL_error(L, "setStat: need appId and steamId string");
401 if (!lua_isinteger(L, 1))
402 return luaL_error(L, "setStat: appId must be integer");
403 if (!lua_isstring(L, 2))
404 return luaL_error(L, "setStat: steamId must be string");
405
406 lua_Integer val = lua_tointeger(L, 1);
407 if (val < 0 || val > UINT32_MAX)
408 return luaL_error(L, "setStat: appId out of range");
409 AppId_t appId = static_cast<uint32_t>(val);
410
411 const char* sidStr = lua_tostring(L, 2);
412 uint64_t steamId = 0;
413 if (!ParseUInt64Decimal(sidStr, &steamId))
414 return luaL_error(L, "setStat: steamId must be all digits");
415
416 StatSteamIdSet[appId] = steamId;
417 return 0;
418 }
419
420 // ── init / cleanup ───────────────────────────────────────────
421 static bool Initialize() {

Callers

nothing calls this directly

Calls 1

ParseUInt64DecimalFunction · 0.85

Tested by

no test coverage detected