parent
75003e1537
commit
4e82a58060
|
@ -861,6 +861,11 @@ void cLuaState::GetStackValue(int a_StackPos, eWeather & a_ReturnedVal)
|
|||
|
||||
void cLuaState::GetStackValue(int a_StackPos, pBoundingBox & a_ReturnedVal)
|
||||
{
|
||||
if (lua_isnil(m_LuaState, a_StackPos))
|
||||
{
|
||||
a_ReturnedVal = NULL;
|
||||
return;
|
||||
}
|
||||
tolua_Error err;
|
||||
if (tolua_isusertype(m_LuaState, a_StackPos, "cBoundingBox", false, &err))
|
||||
{
|
||||
|
@ -874,6 +879,11 @@ void cLuaState::GetStackValue(int a_StackPos, pBoundingBox & a_ReturnedVal)
|
|||
|
||||
void cLuaState::GetStackValue(int a_StackPos, pWorld & a_ReturnedVal)
|
||||
{
|
||||
if (lua_isnil(m_LuaState, a_StackPos))
|
||||
{
|
||||
a_ReturnedVal = NULL;
|
||||
return;
|
||||
}
|
||||
tolua_Error err;
|
||||
if (tolua_isusertype(m_LuaState, a_StackPos, "cWorld", false, &err))
|
||||
{
|
||||
|
@ -1396,10 +1406,8 @@ void cLuaState::LogStack(const char * a_Header)
|
|||
|
||||
void cLuaState::LogStack(lua_State * a_LuaState, const char * a_Header)
|
||||
{
|
||||
UNUSED(a_Header); // The param seems unused when compiling for release, so the compiler warns
|
||||
|
||||
// Format string consisting only of %s is used to appease the compiler
|
||||
LOGD("%s", (a_Header != NULL) ? a_Header : "Lua C API Stack contents:");
|
||||
LOG("%s", (a_Header != NULL) ? a_Header : "Lua C API Stack contents:");
|
||||
for (int i = lua_gettop(a_LuaState); i > 0; i--)
|
||||
{
|
||||
AString Value;
|
||||
|
|
|
@ -304,7 +304,7 @@ public:
|
|||
void ToString(int a_StackPos, AString & a_String);
|
||||
|
||||
/** Logs all the elements' types on the API stack, with an optional header for the listing. */
|
||||
void LogStack(const char * a_Header);
|
||||
void LogStack(const char * a_Header = NULL);
|
||||
|
||||
/** Logs all the elements' types on the API stack, with an optional header for the listing. */
|
||||
static void LogStack(lua_State * a_LuaState, const char * a_Header = NULL);
|
||||
|
|
|
@ -697,8 +697,12 @@ static int tolua_ForEachInBox(lua_State * tolua_S)
|
|||
Ty1 * Self = NULL;
|
||||
cBoundingBox * Box = NULL;
|
||||
L.GetStackValues(1, Self, Box);
|
||||
ASSERT(Self != NULL); // We have verified the type at the top, so we should get valid objects here
|
||||
ASSERT(Box != NULL);
|
||||
if ((Self == NULL) || (Box == NULL))
|
||||
{
|
||||
LOGWARNING("Invalid world (%p) or boundingbox (%p)", Self, Box);
|
||||
L.LogStackTrace();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Create a reference for the function:
|
||||
cLuaState::cRef FnRef(L, 3);
|
||||
|
|
Loading…
Reference in New Issue