/
redgpu
/
ezEngine
Обзор
Документация
Войти
/
redgpu
/
ezEngine
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
Code/Engine/Core/Scripting/LuaWrapper/Tables.cpp
66 строк
1 KB
Ingrater
Clang-format fixes and update to 18.1.1 (#1234)
10 мар 2024, 15:51
Не верифицирован
10 мар 2024, 15:51
2f16acf
Код
Авторство
О чём код?
#include <Core/CorePCH.h> #include <Core/Scripting/LuaWrapper.h> #ifdef BUILDSYSTEM_ENABLE_LUA_SUPPORT ezResult ezLuaWrapper::OpenTable(const char* szName) { if (m_States.m_iOpenTables == 0) lua_getglobal(m_pState, szName); else { lua_pushstring(m_pState, szName); lua_gettable(m_pState, -2); } // failed, it's no table if (lua_istable(m_pState, -1) == 0) { lua_pop(m_pState, 1); return EZ_FAILURE; } m_States.m_iOpenTables++; return EZ_SUCCESS; } ezResult ezLuaWrapper::OpenTableFromParameter(ezUInt32 uiFunctionParameter) { lua_pushvalue(m_pState, uiFunctionParameter + s_iParamOffset); // failed, it's no table if (lua_istable(m_pState, -1) == 0) { lua_pop(m_pState, 1); return EZ_FAILURE; } m_States.m_iOpenTables++; return EZ_SUCCESS; } void ezLuaWrapper::CloseTable() { DiscardReturnValues(); if (m_States.m_iOpenTables == 0) return; m_States.m_iOpenTables--; lua_pop(m_pState, 1); } void ezLuaWrapper::CloseAllTables() { DiscardReturnValues(); if (m_States.m_iOpenTables == 0) return; lua_pop(m_pState, m_States.m_iOpenTables); m_States.m_iOpenTables = 0; } #endif // BUILDSYSTEM_ENABLE_LUA_SUPPORT