── Lua: setStat ────────────────────────────────────────────
| 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() { |
nothing calls this directly
no test coverage detected