mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-15 23:50:38 +00:00
Add Game::Lua::PushBool helper, sweep condition ? 1 : 0 patterns
PushBool(L, bool) wraps lua_pushboolean and centralizes the bool→int conversion the engine ABI requires. All ~50 sites doing `PushBoolean(L, condition ? 1 : 0)` collapse to `PushBool(L, condition)`. Non-PushBoolean callers passing bool→int (Fire_*, FireGetItemInfoReceived, etc.) switched to `static_cast<int>(...)`. NameCache settings file output relies on the default ostream bool→"0"/"1" formatting. Literal `PushBoolean(L, 0)` / `PushBoolean(L, 1)` left alone — they're already explicit int values.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// This file is part of ClassicAPI.
|
||||
// This file is part of ClassicAPI.
|
||||
//
|
||||
// ClassicAPI is free software: you can redistribute it and/or modify it under the terms
|
||||
// of the GNU Lesser General Public License as published by the Free Software Foundation, either
|
||||
@@ -142,7 +142,7 @@ void PicojsonToLua(void *L, const picojson::value &v) {
|
||||
if (v.is<picojson::null>()) {
|
||||
Game::Lua::PushNil(L);
|
||||
} else if (v.is<bool>()) {
|
||||
Game::Lua::PushBoolean(L, v.get<bool>() ? 1 : 0);
|
||||
Game::Lua::PushBool(L, v.get<bool>());
|
||||
} else if (v.is<double>()) {
|
||||
Game::Lua::PushNumber(L, v.get<double>());
|
||||
} else if (v.is<int64_t>()) {
|
||||
|
||||
Reference in New Issue
Block a user