summaryrefslogtreecommitdiffstats
path: root/src/Bindings/LuaState.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Bindings/LuaState.cpp')
-rw-r--r--src/Bindings/LuaState.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp
index 81dcb0e67..8c47ab322 100644
--- a/src/Bindings/LuaState.cpp
+++ b/src/Bindings/LuaState.cpp
@@ -388,10 +388,8 @@ cLuaState::cStackTable::cStackTable(cLuaState & a_LuaState, int a_StackPos):
void cLuaState::cStackTable::ForEachArrayElement(cFunctionRef<bool(cLuaState & a_LuaState, int a_Index)> a_ElementCallback) const
{
- auto numElements = luaL_getn(m_LuaState, m_StackPos);
- #ifdef _DEBUG
- auto stackTop = lua_gettop(m_LuaState);
- #endif
+ const auto numElements = luaL_getn(m_LuaState, m_StackPos);
+ [[maybe_unused]] const auto stackTop = lua_gettop(m_LuaState);
for (int idx = 1; idx <= numElements; idx++)
{
// Push the idx-th element of the array onto stack top and call the callback:
@@ -413,9 +411,7 @@ void cLuaState::cStackTable::ForEachArrayElement(cFunctionRef<bool(cLuaState & a
void cLuaState::cStackTable::ForEachElement(cFunctionRef<bool(cLuaState & a_LuaState)> a_ElementCallback) const
{
- #ifdef _DEBUG
- auto stackTop = lua_gettop(m_LuaState);
- #endif
+ [[maybe_unused]] const auto stackTop = lua_gettop(m_LuaState);
lua_pushvalue(m_LuaState, m_StackPos); // Stk: <table>
lua_pushnil(m_LuaState); // Stk: <table> nil
while (lua_next(m_LuaState, -2)) // Stk: <table> <key> <val>
@@ -2255,11 +2251,10 @@ int cLuaState::CopyStackFrom(cLuaState & a_SrcLuaState, int a_SrcStart, int a_Sr
bool cLuaState::CopyTableFrom(cLuaState & a_SrcLuaState, int a_SrcStackIdx, int a_NumAllowedNestingLevels)
{
+ [[maybe_unused]] const auto srcTop = lua_gettop(a_SrcLuaState);
+ [[maybe_unused]] const auto dstTop = lua_gettop(m_LuaState);
+
// Create the dest table:
- #ifdef _DEBUG
- auto srcTop = lua_gettop(a_SrcLuaState);
- auto dstTop = lua_gettop(m_LuaState);
- #endif
lua_createtable(m_LuaState, 0, 0); // DST: <table>
lua_pushvalue(a_SrcLuaState, a_SrcStackIdx); // SRC: <table>
lua_pushnil(a_SrcLuaState); // SRC: <table> <key>