1
0

Fixed assert failures in cLuaState when using it for pushing a StringVector.

This commit is contained in:
madmaxoft 2013-08-18 00:20:23 +02:00
parent d287183137
commit 5efbb46ff0

View File

@ -296,7 +296,6 @@ bool cLuaState::PushFunctionFromRefTable(cRef & a_TableRef, const char * a_FnNam
void cLuaState::Push(const AString & a_String)
{
ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushcppstring(m_LuaState, a_String);
m_NumCurrentFunctionArgs += 1;
@ -309,7 +308,6 @@ void cLuaState::Push(const AString & a_String)
void cLuaState::Push(const AStringVector & a_Vector)
{
ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
lua_createtable(m_LuaState, a_Vector.size(), 0);
int newTable = lua_gettop(m_LuaState);
@ -329,7 +327,6 @@ void cLuaState::Push(const AStringVector & a_Vector)
void cLuaState::PushUserType(void * a_Object, const char * a_Type)
{
ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, a_Object, a_Type);
m_NumCurrentFunctionArgs += 1;
@ -342,7 +339,6 @@ void cLuaState::PushUserType(void * a_Object, const char * a_Type)
void cLuaState::Push(int a_Value)
{
ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushnumber(m_LuaState, a_Value);
m_NumCurrentFunctionArgs += 1;
@ -355,7 +351,6 @@ void cLuaState::Push(int a_Value)
void cLuaState::Push(double a_Value)
{
ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushnumber(m_LuaState, a_Value);
m_NumCurrentFunctionArgs += 1;
@ -368,7 +363,6 @@ void cLuaState::Push(double a_Value)
void cLuaState::Push(const char * a_Value)
{
ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushstring(m_LuaState, a_Value);
m_NumCurrentFunctionArgs += 1;
@ -381,7 +375,6 @@ void cLuaState::Push(const char * a_Value)
void cLuaState::Push(bool a_Value)
{
ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushboolean(m_LuaState, a_Value ? 1 : 0);
m_NumCurrentFunctionArgs += 1;
@ -394,7 +387,6 @@ void cLuaState::Push(bool a_Value)
void cLuaState::Push(cWorld * a_World)
{
ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, a_World, "cWorld");
m_NumCurrentFunctionArgs += 1;
@ -407,7 +399,6 @@ void cLuaState::Push(cWorld * a_World)
void cLuaState::Push(cPlayer * a_Player)
{
ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, a_Player, "cPlayer");
m_NumCurrentFunctionArgs += 1;
@ -420,7 +411,6 @@ void cLuaState::Push(cPlayer * a_Player)
void cLuaState::Push(const cPlayer * a_Player)
{
ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, (void *)a_Player, "cPlayer");
m_NumCurrentFunctionArgs += 1;
@ -433,7 +423,6 @@ void cLuaState::Push(const cPlayer * a_Player)
void cLuaState::Push(cEntity * a_Entity)
{
ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, a_Entity, "cEntity");
m_NumCurrentFunctionArgs += 1;
@ -446,7 +435,6 @@ void cLuaState::Push(cEntity * a_Entity)
void cLuaState::Push(cMonster * a_Monster)
{
ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, a_Monster, "cMonster");
m_NumCurrentFunctionArgs += 1;
@ -459,7 +447,6 @@ void cLuaState::Push(cMonster * a_Monster)
void cLuaState::Push(cItem * a_Item)
{
ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, a_Item, "cItem");
m_NumCurrentFunctionArgs += 1;
@ -472,7 +459,6 @@ void cLuaState::Push(cItem * a_Item)
void cLuaState::Push(cItems * a_Items)
{
ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, a_Items, "cItems");
m_NumCurrentFunctionArgs += 1;
@ -485,7 +471,6 @@ void cLuaState::Push(cItems * a_Items)
void cLuaState::Push(cClientHandle * a_Client)
{
ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, a_Client, "cClientHandle");
m_NumCurrentFunctionArgs += 1;
@ -498,7 +483,6 @@ void cLuaState::Push(cClientHandle * a_Client)
void cLuaState::Push(cPickup * a_Pickup)
{
ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, a_Pickup, "cPickup");
m_NumCurrentFunctionArgs += 1;
@ -511,7 +495,6 @@ void cLuaState::Push(cPickup * a_Pickup)
void cLuaState::Push(cChunkDesc * a_ChunkDesc)
{
ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, a_ChunkDesc, "cChunkDesc");
m_NumCurrentFunctionArgs += 1;
@ -524,7 +507,6 @@ void cLuaState::Push(cChunkDesc * a_ChunkDesc)
void cLuaState::Push(const cCraftingGrid * a_Grid)
{
ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, (void *)a_Grid, "cCraftingGrid");
m_NumCurrentFunctionArgs += 1;
@ -537,7 +519,6 @@ void cLuaState::Push(const cCraftingGrid * a_Grid)
void cLuaState::Push(const cCraftingRecipe * a_Recipe)
{
ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, (void *)a_Recipe, "cCraftingRecipe");
m_NumCurrentFunctionArgs += 1;
@ -550,7 +531,6 @@ void cLuaState::Push(const cCraftingRecipe * a_Recipe)
void cLuaState::Push(TakeDamageInfo * a_TDI)
{
ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, a_TDI, "TakeDamageInfo");
m_NumCurrentFunctionArgs += 1;
@ -563,7 +543,6 @@ void cLuaState::Push(TakeDamageInfo * a_TDI)
void cLuaState::Push(cWindow * a_Window)
{
ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, a_Window, "cWindow");
m_NumCurrentFunctionArgs += 1;
@ -576,7 +555,6 @@ void cLuaState::Push(cWindow * a_Window)
void cLuaState::Push(cPlugin_NewLua * a_Plugin)
{
ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, a_Plugin, "cPlugin_NewLua");
m_NumCurrentFunctionArgs += 1;
@ -589,7 +567,6 @@ void cLuaState::Push(cPlugin_NewLua * a_Plugin)
void cLuaState::Push(const HTTPRequest * a_Request)
{
ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, (void *)a_Request, "HTTPRequest");
m_NumCurrentFunctionArgs += 1;
@ -602,7 +579,6 @@ void cLuaState::Push(const HTTPRequest * a_Request)
void cLuaState::Push(cWebAdmin * a_WebAdmin)
{
ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, a_WebAdmin, "cWebAdmin");
m_NumCurrentFunctionArgs += 1;
@ -615,7 +591,6 @@ void cLuaState::Push(cWebAdmin * a_WebAdmin)
void cLuaState::Push(const HTTPTemplateRequest * a_Request)
{
ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, (void *)a_Request, "HTTPTemplateRequest");
m_NumCurrentFunctionArgs += 1;
@ -628,7 +603,6 @@ void cLuaState::Push(const HTTPTemplateRequest * a_Request)
void cLuaState::Push(cTNTEntity * a_TNTEntity)
{
ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, a_TNTEntity, "cTNTEntity");
m_NumCurrentFunctionArgs += 1;
@ -641,7 +615,6 @@ void cLuaState::Push(cTNTEntity * a_TNTEntity)
void cLuaState::Push(cCreeper * a_Creeper)
{
ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, a_Creeper, "cCreeper");
m_NumCurrentFunctionArgs += 1;
@ -654,7 +627,6 @@ void cLuaState::Push(cCreeper * a_Creeper)
void cLuaState::Push(Vector3i * a_Vector)
{
ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, a_Vector, "Vector3i");
m_NumCurrentFunctionArgs += 1;
@ -667,7 +639,6 @@ void cLuaState::Push(Vector3i * a_Vector)
void cLuaState::Push(void * a_Ptr)
{
ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
lua_pushnil(m_LuaState);
m_NumCurrentFunctionArgs += 1;
@ -680,7 +651,6 @@ void cLuaState::Push(void * a_Ptr)
void cLuaState::Push(cHopperEntity * a_Hopper)
{
ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, a_Hopper, "cHopperEntity");
m_NumCurrentFunctionArgs += 1;
@ -693,7 +663,6 @@ void cLuaState::Push(cHopperEntity * a_Hopper)
void cLuaState::Push(cBlockEntity * a_BlockEntity)
{
ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
tolua_pushusertype(m_LuaState, a_BlockEntity, "cBlockEntity");
m_NumCurrentFunctionArgs += 1;