From 448df85e569e85e1b4da4eac685950273f30ae1f Mon Sep 17 00:00:00 2001 From: tycho Date: Sat, 21 Mar 2015 17:17:26 +0000 Subject: Added support for additional data in the ParticleEffect Packet Also started refactoring how broadcasts are handled --- src/Bindings/LuaState.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/Bindings/LuaState.h') diff --git a/src/Bindings/LuaState.h b/src/Bindings/LuaState.h index 6bedbf5ec..3f2e828f3 100644 --- a/src/Bindings/LuaState.h +++ b/src/Bindings/LuaState.h @@ -76,6 +76,7 @@ typedef cPluginManager * pPluginManager; typedef cRoot * pRoot; typedef cScoreboard * pScoreboard; typedef cWorld * pWorld; +typedef cClientHandle * pClientHandle; @@ -254,6 +255,7 @@ public: void GetStackValue(int a_StackPos, int & a_Value); void GetStackValue(int a_StackPos, pBlockArea & a_Value); void GetStackValue(int a_StackPos, pBoundingBox & a_Value); + void GetStackValue(int a_StackPos, pClientHandle & a_Value); void GetStackValue(int a_StackPos, pMapManager & a_Value); void GetStackValue(int a_StackPos, pPluginManager & a_Value); void GetStackValue(int a_StackPos, pRoot & a_Value); @@ -307,6 +309,10 @@ public: /** Returns true if the specified parameter on the stack is nil (indicating an end-of-parameters) */ bool CheckParamEnd(int a_Param); + bool IsParamUserType(int a_Param, AString a_UserType); + + bool IsParamNumber(int a_Param); + /** If the status is nonzero, prints the text on the top of Lua stack and returns true */ bool ReportErrors(int status); -- cgit v1.2.3 From 218010cd96a3e887e7fbd8e18e1b74b7dc481036 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 8 May 2015 23:32:02 +0100 Subject: Fixed some Visual Studio warnings --- src/Bindings/LuaState.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/Bindings/LuaState.h') diff --git a/src/Bindings/LuaState.h b/src/Bindings/LuaState.h index 3f2e828f3..4377ed5d0 100644 --- a/src/Bindings/LuaState.h +++ b/src/Bindings/LuaState.h @@ -251,6 +251,7 @@ public: void GetStackValue(int a_StackPos, bool & a_Value); void GetStackValue(int a_StackPos, cRef & a_Ref); void GetStackValue(int a_StackPos, double & a_Value); + void GetStackValue(int a_StackPos, float & a_ReturnedVal); void GetStackValue(int a_StackPos, eWeather & a_Value); void GetStackValue(int a_StackPos, int & a_Value); void GetStackValue(int a_StackPos, pBlockArea & a_Value); -- cgit v1.2.3 From dd10ffb63ad98cf2f4df2141a8fd64c21d414529 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sun, 10 May 2015 23:11:30 +0200 Subject: OnExecuteCommand hook can override the command result (crXXX). --- src/Bindings/LuaState.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/Bindings/LuaState.h') diff --git a/src/Bindings/LuaState.h b/src/Bindings/LuaState.h index 4377ed5d0..959a62bb8 100644 --- a/src/Bindings/LuaState.h +++ b/src/Bindings/LuaState.h @@ -32,6 +32,7 @@ extern "C" #include "../Vector3.h" #include "../Defines.h" +#include "PluginManager.h" @@ -57,7 +58,6 @@ class cPickup; class cPlayer; class cPlugin; class cPluginLua; -class cPluginManager; class cProjectileEntity; class cRoot; class cScoreboard; @@ -249,6 +249,7 @@ public: void GetStackValue(int a_StackPos, AString & a_Value); void GetStackValue(int a_StackPos, BLOCKTYPE & a_Value); void GetStackValue(int a_StackPos, bool & a_Value); + void GetStackValue(int a_StackPos, cPluginManager::CommandResult & a_Result); void GetStackValue(int a_StackPos, cRef & a_Ref); void GetStackValue(int a_StackPos, double & a_Value); void GetStackValue(int a_StackPos, float & a_ReturnedVal); -- cgit v1.2.3 From 4b97569b3a635260cc9ce71470fc9b09cfb38167 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Tue, 12 May 2015 09:20:54 +0200 Subject: ToLua now generates cLuaState::Push() and GetStackValue() For classes exported through ToLua it generates the cLuaState::Push() and cLuaState::GetStackValue() functions, as well as the supporting forward declarations and typedefs. Renamed virtual_method_hooks.lua to BindingsProcessor.lua since it no longer provides virtual method hooks and instead does additional processing when generating the bindings. --- src/Bindings/LuaState.h | 85 +++++++------------------------------------------ 1 file changed, 11 insertions(+), 74 deletions(-) (limited to 'src/Bindings/LuaState.h') diff --git a/src/Bindings/LuaState.h b/src/Bindings/LuaState.h index 959a62bb8..b38401fd8 100644 --- a/src/Bindings/LuaState.h +++ b/src/Bindings/LuaState.h @@ -33,50 +33,12 @@ extern "C" #include "../Vector3.h" #include "../Defines.h" #include "PluginManager.h" +#include "LuaState_Typedefs.inc" - - - - -class cBlockArea; -class cBlockEntity; -class cBoundingBox; -class cChunkDesc; -class cClientHandle; -class cCraftingGrid; -class cCraftingRecipe; -class cEntity; -class cHopperEntity; -class cItem; -class cItems; +// fwd: class cLuaServerHandle; class cLuaTCPLink; class cLuaUDPEndpoint; -class cMapManager; -class cMonster; -class cPickup; -class cPlayer; -class cPlugin; -class cPluginLua; -class cProjectileEntity; -class cRoot; -class cScoreboard; -class cTNTEntity; -class cWebAdmin; -class cWindow; -class cWorld; -struct HTTPRequest; -struct HTTPTemplateRequest; -struct TakeDamageInfo; - -typedef cBlockArea * pBlockArea; -typedef cBoundingBox * pBoundingBox; -typedef cMapManager * pMapManager; -typedef cPluginManager * pPluginManager; -typedef cRoot * pRoot; -typedef cScoreboard * pScoreboard; -typedef cWorld * pWorld; -typedef cClientHandle * pClientHandle; @@ -214,35 +176,15 @@ public: void Push(const Vector3i & a_Vector); void Push(const Vector3i * a_Vector); - // Push a value onto the stack (keep alpha-sorted): + // Push a simple 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(cHopperEntity * a_Hopper); - void Push(cItem * a_Item); - void Push(cItems * a_Items); - void Push(cLuaServerHandle * a_ServerHandle); - void Push(cLuaTCPLink * a_TCPLink); - void Push(cLuaUDPEndpoint * a_UDPEndpoint); - void Push(cMonster * a_Monster); - void Push(cPickup * a_Pickup); - void Push(cPlayer * a_Player); - void Push(cPlugin * a_Plugin); - void Push(cPluginLua * a_Plugin); - 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(std::chrono::milliseconds a_time); + void Push(cLuaServerHandle * a_ServerHandle); + void Push(cLuaTCPLink * a_TCPLink); + void Push(cLuaUDPEndpoint * a_UDPEndpoint); // GetStackValue() retrieves the value at a_StackPos, if it is a valid type. If not, a_Value is unchanged. // Enum values are clamped to their allowed range. @@ -252,17 +194,12 @@ public: void GetStackValue(int a_StackPos, cPluginManager::CommandResult & a_Result); void GetStackValue(int a_StackPos, cRef & a_Ref); void GetStackValue(int a_StackPos, double & a_Value); - void GetStackValue(int a_StackPos, float & a_ReturnedVal); void GetStackValue(int a_StackPos, eWeather & a_Value); + void GetStackValue(int a_StackPos, float & a_ReturnedVal); void GetStackValue(int a_StackPos, int & a_Value); - void GetStackValue(int a_StackPos, pBlockArea & a_Value); - void GetStackValue(int a_StackPos, pBoundingBox & a_Value); - void GetStackValue(int a_StackPos, pClientHandle & a_Value); - void GetStackValue(int a_StackPos, pMapManager & a_Value); - void GetStackValue(int a_StackPos, pPluginManager & a_Value); - void GetStackValue(int a_StackPos, pRoot & a_Value); - void GetStackValue(int a_StackPos, pScoreboard & a_Value); - void GetStackValue(int a_StackPos, pWorld & a_Value); + + // Include the auto-generated Push and GetStackValue() functions: + #include "LuaState_Declaration.inc" /** Call the specified Lua function. Returns true if call succeeded, false if there was an error. @@ -441,7 +378,7 @@ protected: bool PushFunction(const cTableRef & a_TableRef); /** Pushes a usertype of the specified class type onto the stack */ - void PushUserType(void * a_Object, const char * a_Type); + // void PushUserType(void * a_Object, const char * a_Type); /** Calls the function that has been pushed onto the stack by PushFunction(), -- cgit v1.2.3 From 1240c76cb472931253e2ce502356c0428f974c5a Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sat, 16 May 2015 16:19:18 +0200 Subject: Lua: Break into ZBS debugger on API errors. --- src/Bindings/LuaState.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/Bindings/LuaState.h') diff --git a/src/Bindings/LuaState.h b/src/Bindings/LuaState.h index b38401fd8..5b4ec3ae4 100644 --- a/src/Bindings/LuaState.h +++ b/src/Bindings/LuaState.h @@ -389,6 +389,9 @@ protected: /** Used as the error reporting function for function calls */ static int ReportFnCallErrors(lua_State * a_LuaState); + + /** Tries to break into the MobDebug debugger, if it is installed. */ + static int BreakIntoDebugger(lua_State * a_LuaState); } ; -- cgit v1.2.3