diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-06-17 19:03:56 +0200 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-06-17 19:03:56 +0200 |
commit | c60ba8a52d6f84316eae041a24e395a4c37ae181 (patch) | |
tree | edb983f4b20312115bc1033a2bd5a89c615ed30e /src/Bindings/LuaState.cpp | |
parent | Check block type from cBlockEntity (diff) | |
parent | Merge pull request #1099 from Howaner/Blocks (diff) | |
download | cuberite-c60ba8a52d6f84316eae041a24e395a4c37ae181.tar cuberite-c60ba8a52d6f84316eae041a24e395a4c37ae181.tar.gz cuberite-c60ba8a52d6f84316eae041a24e395a4c37ae181.tar.bz2 cuberite-c60ba8a52d6f84316eae041a24e395a4c37ae181.tar.lz cuberite-c60ba8a52d6f84316eae041a24e395a4c37ae181.tar.xz cuberite-c60ba8a52d6f84316eae041a24e395a4c37ae181.tar.zst cuberite-c60ba8a52d6f84316eae041a24e395a4c37ae181.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Bindings/LuaState.cpp | 147 |
1 files changed, 86 insertions, 61 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; } |