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