summaryrefslogtreecommitdiffstats
path: root/src/Bindings
diff options
context:
space:
mode:
Diffstat (limited to 'src/Bindings')
-rw-r--r--src/Bindings/LuaState.cpp147
-rw-r--r--src/Bindings/LuaState.h44
-rw-r--r--src/Bindings/PluginLua.cpp2
3 files changed, 111 insertions, 82 deletions
diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp
index a33459ad2..7a5ed1425 100644
--- a/src/Bindings/LuaState.cpp
+++ b/src/Bindings/LuaState.cpp
@@ -372,11 +372,11 @@ void cLuaState::Push(const AStringVector & a_Vector)
-void cLuaState::PushUserType(void * a_Object, const char * a_Type)
+void cLuaState::Push(const cCraftingGrid * a_Grid)
{
ASSERT(IsValid());
- tolua_pushusertype(m_LuaState, a_Object, a_Type);
+ tolua_pushusertype(m_LuaState, (void *)a_Grid, "cCraftingGrid");
m_NumCurrentFunctionArgs += 1;
}
@@ -384,11 +384,11 @@ void cLuaState::PushUserType(void * a_Object, const char * a_Type)
-void cLuaState::Push(int a_Value)
+void cLuaState::Push(const cCraftingRecipe * a_Recipe)
{
ASSERT(IsValid());
- tolua_pushnumber(m_LuaState, a_Value);
+ tolua_pushusertype(m_LuaState, (void *)a_Recipe, "cCraftingRecipe");
m_NumCurrentFunctionArgs += 1;
}
@@ -396,11 +396,11 @@ void cLuaState::Push(int a_Value)
-void cLuaState::Push(double a_Value)
+void cLuaState::Push(const char * a_Value)
{
ASSERT(IsValid());
- tolua_pushnumber(m_LuaState, a_Value);
+ tolua_pushstring(m_LuaState, a_Value);
m_NumCurrentFunctionArgs += 1;
}
@@ -408,11 +408,11 @@ void cLuaState::Push(double a_Value)
-void cLuaState::Push(const char * a_Value)
+void cLuaState::Push(const cItems & a_Items)
{
ASSERT(IsValid());
- tolua_pushstring(m_LuaState, a_Value);
+ tolua_pushusertype(m_LuaState, (void *)&a_Items, "cItems");
m_NumCurrentFunctionArgs += 1;
}
@@ -420,11 +420,11 @@ void cLuaState::Push(const char * a_Value)
-void cLuaState::Push(bool a_Value)
+void cLuaState::Push(const cPlayer * a_Player)
{
ASSERT(IsValid());
- tolua_pushboolean(m_LuaState, a_Value ? 1 : 0);
+ tolua_pushusertype(m_LuaState, (void *)a_Player, "cPlayer");
m_NumCurrentFunctionArgs += 1;
}
@@ -432,11 +432,11 @@ void cLuaState::Push(bool a_Value)
-void cLuaState::Push(cWorld * a_World)
+void cLuaState::Push(const HTTPRequest * a_Request)
{
ASSERT(IsValid());
- tolua_pushusertype(m_LuaState, a_World, "cWorld");
+ tolua_pushusertype(m_LuaState, (void *)a_Request, "HTTPRequest");
m_NumCurrentFunctionArgs += 1;
}
@@ -444,11 +444,11 @@ void cLuaState::Push(cWorld * a_World)
-void cLuaState::Push(cPlayer * a_Player)
+void cLuaState::Push(const HTTPTemplateRequest * a_Request)
{
ASSERT(IsValid());
- tolua_pushusertype(m_LuaState, a_Player, "cPlayer");
+ tolua_pushusertype(m_LuaState, (void *)a_Request, "HTTPTemplateRequest");
m_NumCurrentFunctionArgs += 1;
}
@@ -456,11 +456,11 @@ void cLuaState::Push(cPlayer * a_Player)
-void cLuaState::Push(const cPlayer * a_Player)
+void cLuaState::Push(const Vector3d & a_Vector)
{
ASSERT(IsValid());
- tolua_pushusertype(m_LuaState, (void *)a_Player, "cPlayer");
+ tolua_pushusertype(m_LuaState, (void *)&a_Vector, "Vector3d");
m_NumCurrentFunctionArgs += 1;
}
@@ -468,11 +468,11 @@ void cLuaState::Push(const cPlayer * a_Player)
-void cLuaState::Push(cEntity * a_Entity)
+void cLuaState::Push(bool a_Value)
{
ASSERT(IsValid());
- tolua_pushusertype(m_LuaState, a_Entity, "cEntity");
+ tolua_pushboolean(m_LuaState, a_Value ? 1 : 0);
m_NumCurrentFunctionArgs += 1;
}
@@ -480,11 +480,11 @@ void cLuaState::Push(cEntity * a_Entity)
-void cLuaState::Push(cProjectileEntity * a_ProjectileEntity)
+void cLuaState::Push(cBlockEntity * a_BlockEntity)
{
ASSERT(IsValid());
- tolua_pushusertype(m_LuaState, a_ProjectileEntity, "cProjectileEntity");
+ tolua_pushusertype(m_LuaState, a_BlockEntity, "cBlockEntity");
m_NumCurrentFunctionArgs += 1;
}
@@ -492,11 +492,47 @@ void cLuaState::Push(cProjectileEntity * a_ProjectileEntity)
-void cLuaState::Push(cMonster * a_Monster)
+void cLuaState::Push(cChunkDesc * a_ChunkDesc)
{
ASSERT(IsValid());
- tolua_pushusertype(m_LuaState, a_Monster, "cMonster");
+ tolua_pushusertype(m_LuaState, a_ChunkDesc, "cChunkDesc");
+ m_NumCurrentFunctionArgs += 1;
+}
+
+
+
+
+
+void cLuaState::Push(cClientHandle * a_Client)
+{
+ ASSERT(IsValid());
+
+ tolua_pushusertype(m_LuaState, a_Client, "cClientHandle");
+ m_NumCurrentFunctionArgs += 1;
+}
+
+
+
+
+
+void cLuaState::Push(cEntity * a_Entity)
+{
+ ASSERT(IsValid());
+
+ tolua_pushusertype(m_LuaState, a_Entity, "cEntity");
+ m_NumCurrentFunctionArgs += 1;
+}
+
+
+
+
+
+void cLuaState::Push(cHopperEntity * a_Hopper)
+{
+ ASSERT(IsValid());
+
+ tolua_pushusertype(m_LuaState, a_Hopper, "cHopperEntity");
m_NumCurrentFunctionArgs += 1;
}
@@ -528,11 +564,11 @@ void cLuaState::Push(cItems * a_Items)
-void cLuaState::Push(const cItems & a_Items)
+void cLuaState::Push(cMonster * a_Monster)
{
ASSERT(IsValid());
- tolua_pushusertype(m_LuaState, (void *)&a_Items, "cItems");
+ tolua_pushusertype(m_LuaState, a_Monster, "cMonster");
m_NumCurrentFunctionArgs += 1;
}
@@ -540,11 +576,11 @@ void cLuaState::Push(const cItems & a_Items)
-void cLuaState::Push(cClientHandle * a_Client)
+void cLuaState::Push(cPickup * a_Pickup)
{
ASSERT(IsValid());
- tolua_pushusertype(m_LuaState, a_Client, "cClientHandle");
+ tolua_pushusertype(m_LuaState, a_Pickup, "cPickup");
m_NumCurrentFunctionArgs += 1;
}
@@ -552,11 +588,11 @@ void cLuaState::Push(cClientHandle * a_Client)
-void cLuaState::Push(cPickup * a_Pickup)
+void cLuaState::Push(cPlayer * a_Player)
{
ASSERT(IsValid());
- tolua_pushusertype(m_LuaState, a_Pickup, "cPickup");
+ tolua_pushusertype(m_LuaState, a_Player, "cPlayer");
m_NumCurrentFunctionArgs += 1;
}
@@ -564,11 +600,11 @@ void cLuaState::Push(cPickup * a_Pickup)
-void cLuaState::Push(cChunkDesc * a_ChunkDesc)
+void cLuaState::Push(cPluginLua * a_Plugin)
{
ASSERT(IsValid());
- tolua_pushusertype(m_LuaState, a_ChunkDesc, "cChunkDesc");
+ tolua_pushusertype(m_LuaState, a_Plugin, "cPluginLua");
m_NumCurrentFunctionArgs += 1;
}
@@ -576,11 +612,11 @@ void cLuaState::Push(cChunkDesc * a_ChunkDesc)
-void cLuaState::Push(const cCraftingGrid * a_Grid)
+void cLuaState::Push(cProjectileEntity * a_ProjectileEntity)
{
ASSERT(IsValid());
- tolua_pushusertype(m_LuaState, (void *)a_Grid, "cCraftingGrid");
+ tolua_pushusertype(m_LuaState, a_ProjectileEntity, "cProjectileEntity");
m_NumCurrentFunctionArgs += 1;
}
@@ -588,11 +624,11 @@ void cLuaState::Push(const cCraftingGrid * a_Grid)
-void cLuaState::Push(const cCraftingRecipe * a_Recipe)
+void cLuaState::Push(cTNTEntity * a_TNTEntity)
{
ASSERT(IsValid());
- tolua_pushusertype(m_LuaState, (void *)a_Recipe, "cCraftingRecipe");
+ tolua_pushusertype(m_LuaState, a_TNTEntity, "cTNTEntity");
m_NumCurrentFunctionArgs += 1;
}
@@ -600,11 +636,11 @@ void cLuaState::Push(const cCraftingRecipe * a_Recipe)
-void cLuaState::Push(TakeDamageInfo * a_TDI)
+void cLuaState::Push(cWebAdmin * a_WebAdmin)
{
ASSERT(IsValid());
- tolua_pushusertype(m_LuaState, a_TDI, "TakeDamageInfo");
+ tolua_pushusertype(m_LuaState, a_WebAdmin, "cWebAdmin");
m_NumCurrentFunctionArgs += 1;
}
@@ -624,11 +660,11 @@ void cLuaState::Push(cWindow * a_Window)
-void cLuaState::Push(cPluginLua * a_Plugin)
+void cLuaState::Push(cWorld * a_World)
{
ASSERT(IsValid());
- tolua_pushusertype(m_LuaState, a_Plugin, "cPluginLua");
+ tolua_pushusertype(m_LuaState, a_World, "cWorld");
m_NumCurrentFunctionArgs += 1;
}
@@ -636,11 +672,11 @@ void cLuaState::Push(cPluginLua * a_Plugin)
-void cLuaState::Push(const HTTPRequest * a_Request)
+void cLuaState::Push(double a_Value)
{
ASSERT(IsValid());
- tolua_pushusertype(m_LuaState, (void *)a_Request, "HTTPRequest");
+ tolua_pushnumber(m_LuaState, a_Value);
m_NumCurrentFunctionArgs += 1;
}
@@ -648,11 +684,11 @@ void cLuaState::Push(const HTTPRequest * a_Request)
-void cLuaState::Push(cWebAdmin * a_WebAdmin)
+void cLuaState::Push(int a_Value)
{
ASSERT(IsValid());
- tolua_pushusertype(m_LuaState, a_WebAdmin, "cWebAdmin");
+ tolua_pushnumber(m_LuaState, a_Value);
m_NumCurrentFunctionArgs += 1;
}
@@ -660,11 +696,11 @@ void cLuaState::Push(cWebAdmin * a_WebAdmin)
-void cLuaState::Push(const HTTPTemplateRequest * a_Request)
+void cLuaState::Push(TakeDamageInfo * a_TDI)
{
ASSERT(IsValid());
- tolua_pushusertype(m_LuaState, (void *)a_Request, "HTTPTemplateRequest");
+ tolua_pushusertype(m_LuaState, a_TDI, "TakeDamageInfo");
m_NumCurrentFunctionArgs += 1;
}
@@ -672,11 +708,11 @@ void cLuaState::Push(const HTTPTemplateRequest * a_Request)
-void cLuaState::Push(cTNTEntity * a_TNTEntity)
+void cLuaState::Push(Vector3i * a_Vector)
{
ASSERT(IsValid());
- tolua_pushusertype(m_LuaState, a_TNTEntity, "cTNTEntity");
+ tolua_pushusertype(m_LuaState, a_Vector, "Vector3i");
m_NumCurrentFunctionArgs += 1;
}
@@ -684,11 +720,11 @@ void cLuaState::Push(cTNTEntity * a_TNTEntity)
-void cLuaState::Push(Vector3i * a_Vector)
+void cLuaState::Push(Vector3d * a_Vector)
{
ASSERT(IsValid());
- tolua_pushusertype(m_LuaState, a_Vector, "Vector3i");
+ tolua_pushusertype(m_LuaState, a_Vector, "Vector3d");
m_NumCurrentFunctionArgs += 1;
}
@@ -715,23 +751,12 @@ void cLuaState::Push(void * a_Ptr)
-void cLuaState::Push(cHopperEntity * a_Hopper)
-{
- ASSERT(IsValid());
-
- tolua_pushusertype(m_LuaState, a_Hopper, "cHopperEntity");
- m_NumCurrentFunctionArgs += 1;
-}
-
-
-
-
-void cLuaState::Push(cBlockEntity * a_BlockEntity)
+void cLuaState::PushUserType(void * a_Object, const char * a_Type)
{
ASSERT(IsValid());
- tolua_pushusertype(m_LuaState, a_BlockEntity, "cBlockEntity");
+ tolua_pushusertype(m_LuaState, a_Object, a_Type);
m_NumCurrentFunctionArgs += 1;
}
diff --git a/src/Bindings/LuaState.h b/src/Bindings/LuaState.h
index b9ca2f29b..066390e39 100644
--- a/src/Bindings/LuaState.h
+++ b/src/Bindings/LuaState.h
@@ -173,38 +173,42 @@ public:
/** Returns true if a_FunctionName is a valid Lua function that can be called */
bool HasFunction(const char * a_FunctionName);
- // Push a value onto the stack
+ // Push a const value onto the stack (keep alpha-sorted):
void Push(const AString & a_String);
void Push(const AStringVector & a_Vector);
- void Push(int a_Value);
- void Push(double a_Value);
+ void Push(const cCraftingGrid * a_Grid);
+ void Push(const cCraftingRecipe * a_Recipe);
void Push(const char * a_Value);
- void Push(bool a_Value);
- void Push(cWorld * a_World);
- void Push(cPlayer * a_Player);
+ void Push(const cItems & a_Items);
void Push(const cPlayer * a_Player);
+ void Push(const HTTPRequest * a_Request);
+ void Push(const HTTPTemplateRequest * a_Request);
+ void Push(const Vector3d & a_Vector);
+
+ // Push a value onto the stack (keep alpha-sorted):
+ void Push(bool a_Value);
+ void Push(cBlockEntity * a_BlockEntity);
+ void Push(cChunkDesc * a_ChunkDesc);
+ void Push(cClientHandle * a_ClientHandle);
void Push(cEntity * a_Entity);
- void Push(cProjectileEntity * a_ProjectileEntity);
- void Push(cMonster * a_Monster);
+ void Push(cHopperEntity * a_Hopper);
void Push(cItem * a_Item);
void Push(cItems * a_Items);
- void Push(const cItems & a_Items);
- void Push(cClientHandle * a_ClientHandle);
+ void Push(cMonster * a_Monster);
void Push(cPickup * a_Pickup);
- void Push(cChunkDesc * a_ChunkDesc);
- void Push(const cCraftingGrid * a_Grid);
- void Push(const cCraftingRecipe * a_Recipe);
- void Push(TakeDamageInfo * a_TDI);
- void Push(cWindow * a_Window);
+ void Push(cPlayer * a_Player);
void Push(cPluginLua * a_Plugin);
- void Push(const HTTPRequest * a_Request);
- void Push(cWebAdmin * a_WebAdmin);
- void Push(const HTTPTemplateRequest * a_Request);
+ void Push(cProjectileEntity * a_ProjectileEntity);
void Push(cTNTEntity * a_TNTEntity);
+ void Push(cWebAdmin * a_WebAdmin);
+ void Push(cWindow * a_Window);
+ void Push(cWorld * a_World);
+ void Push(double a_Value);
+ void Push(int a_Value);
+ void Push(TakeDamageInfo * a_TDI);
+ void Push(Vector3d * a_Vector);
void Push(Vector3i * a_Vector);
void Push(void * a_Ptr);
- void Push(cHopperEntity * a_Hopper);
- void Push(cBlockEntity * a_BlockEntity);
/** Retrieve value at a_StackPos, if it is a valid bool. If not, a_Value is unchanged */
void GetStackValue(int a_StackPos, bool & a_Value);
diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp
index 625931931..04639da60 100644
--- a/src/Bindings/PluginLua.cpp
+++ b/src/Bindings/PluginLua.cpp
@@ -1120,7 +1120,7 @@ bool cPluginLua::OnProjectileHitBlock(cProjectileEntity & a_Projectile, int a_Bl
cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PROJECTILE_HIT_BLOCK];
for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr)
{
- m_LuaState.Call((int)(**itr), &a_Projectile, a_BlockX, a_BlockY, a_BlockZ, a_Face, &a_BlockHitPos, cLuaState::Return, res);
+ m_LuaState.Call((int)(**itr), &a_Projectile, a_BlockX, a_BlockY, a_BlockZ, a_Face, a_BlockHitPos, cLuaState::Return, res);
if (res)
{
return true;