summaryrefslogtreecommitdiffstats
path: root/src/Bindings
diff options
context:
space:
mode:
Diffstat (limited to 'src/Bindings')
-rw-r--r--src/Bindings/.gitignore4
-rw-r--r--src/Bindings/AllToLua.bat2
-rw-r--r--src/Bindings/AllToLua.sh2
-rw-r--r--src/Bindings/AllToLua_lua.bat2
-rw-r--r--src/Bindings/BindingsProcessor.lua161
-rw-r--r--src/Bindings/CMakeLists.txt13
-rw-r--r--src/Bindings/LuaState.cpp377
-rw-r--r--src/Bindings/LuaState.h85
-rw-r--r--src/Bindings/virtual_method_hooks.lua44
9 files changed, 193 insertions, 497 deletions
diff --git a/src/Bindings/.gitignore b/src/Bindings/.gitignore
index 0d00dd578..711ae9c3a 100644
--- a/src/Bindings/.gitignore
+++ b/src/Bindings/.gitignore
@@ -1,2 +1,4 @@
lua51.dll
-LuaState_Call.inc
+LuaState_Declaration.inc
+LuaState_Implementation.cpp
+LuaState_Typedefs.inc
diff --git a/src/Bindings/AllToLua.bat b/src/Bindings/AllToLua.bat
index f085af9e9..44675a886 100644
--- a/src/Bindings/AllToLua.bat
+++ b/src/Bindings/AllToLua.bat
@@ -12,7 +12,7 @@
:: Regenerate the files:
echo Regenerating LUA bindings . . .
-"tolua++.exe" -L virtual_method_hooks.lua -o Bindings.cpp -H Bindings.h AllToLua.pkg
+"tolua++.exe" -L BindingsProcessor.lua -o Bindings.cpp -H Bindings.h AllToLua.pkg
diff --git a/src/Bindings/AllToLua.sh b/src/Bindings/AllToLua.sh
index 887c2490c..625ae4300 100644
--- a/src/Bindings/AllToLua.sh
+++ b/src/Bindings/AllToLua.sh
@@ -1,2 +1,2 @@
#!/bin/bash
-/usr/bin/tolua++ -L virtual_method_hooks.lua -o Bindings.cpp -H Bindings.h AllToLua.pkg
+/usr/bin/tolua++ -L BindingsProcessor.lua -o Bindings.cpp -H Bindings.h AllToLua.pkg
diff --git a/src/Bindings/AllToLua_lua.bat b/src/Bindings/AllToLua_lua.bat
index 81c738f32..2d52c022d 100644
--- a/src/Bindings/AllToLua_lua.bat
+++ b/src/Bindings/AllToLua_lua.bat
@@ -13,7 +13,7 @@
:: Regenerate the files:
echo Regenerating LUA bindings . . .
-lua ..\..\lib\tolua++\src\bin\lua\_driver.lua -L virtual_method_hooks.lua -o Bindings.cpp -H Bindings.h AllToLua.pkg
+lua ..\..\lib\tolua++\src\bin\lua\_driver.lua -L BindingsProcessor.lua -o Bindings.cpp -H Bindings.h AllToLua.pkg
diff --git a/src/Bindings/BindingsProcessor.lua b/src/Bindings/BindingsProcessor.lua
new file mode 100644
index 000000000..f86be6c6d
--- /dev/null
+++ b/src/Bindings/BindingsProcessor.lua
@@ -0,0 +1,161 @@
+
+-- BindingsProcessor.lua
+
+-- Implements additional processing that is done while generating the Lua bindings
+
+
+
+
+
+local access = {public = 0, protected = 1, private = 2}
+
+
+
+
+
+--- Defines classes that have a custom manual Push() implementation and should not generate the automatic one
+-- Map of classname -> true
+local g_HasCustomPushImplementation =
+{
+ cEntity = true
+}
+
+
+
+
+
+function parser_hook(s)
+ local container = classContainer.curr -- get the current container
+
+ -- process access-specifying labels (public, private, etc)
+ do
+ local b, e, label = string.find(s, "^%s*(%w*)%s*:[^:]") -- we need to check for [^:], otherwise it would match 'namespace::type'
+ if b then
+
+ -- found a label, get the new access value from the global 'access' table
+ if access[label] then
+ container.curr_member_access = access[label]
+ end -- else ?
+
+ return strsub(s, e) -- normally we would use 'e+1', but we need to preserve the [^:]
+ end
+ end
+end
+
+
+
+
+
+--- Outputs the helper files supplementing the cLuaState class
+-- Writes:
+-- LuaState_Declaration.inc
+-- LuaState_Implementation.cpp
+-- LuaState_Typedefs.inc
+local function OutputLuaStateHelpers(a_Package)
+ -- Collect all class types from ToLua:
+ local types = {}
+ for idx, item in ipairs(a_Package) do
+ local mt = getmetatable(item) or {}
+ if (mt.classtype == "class") then
+ table.insert(types, {name = item.name, lname = item.lname})
+ end
+ end
+ table.sort(types,
+ function(a_Item1, a_Item2)
+ return (a_Item1.name:lower() < a_Item2.name:lower())
+ end
+ )
+
+ -- Output the typedefs:
+ do
+ local f = assert(io.open("LuaState_Typedefs.inc", "w"))
+ f:write("\n// LuaState_Typedefs.inc\n\n// This file is generated along with the Lua bindings by ToLua. Do not edit manually, do not commit to repo.\n")
+ f:write("// Provides a forward declaration and a typedef for a pointer to each class exported to the Lua API.\n")
+ f:write("\n\n\n\n\n")
+ for _, item in ipairs(types) do
+ if not(item.name:match(".*<.*")) then -- Skip templates altogether
+ -- Classes start with a "c", everything else is a struct:
+ if (item.name:sub(1, 1) == "c") then
+ f:write("class " .. item.name .. ";\n")
+ else
+ f:write("struct " .. item.name .. ";\n")
+ end
+ end
+ end
+ f:write("\n\n\n\n\n")
+ for _, item in ipairs(types) do
+ f:write("typedef " .. item.name .. " * Ptr" .. item.lname .. ";\n")
+ end
+ f:write("\n\n\n\n\n")
+ f:close()
+ end
+
+ -- Output the Push() and GetStackValue() function declarations:
+ do
+ local f = assert(io.open("LuaState_Declaration.inc", "w"))
+ f:write("\n// LuaState_Declaration.inc\n\n// This file is generated along with the Lua bindings by ToLua. Do not edit manually, do not commit to repo.\n")
+ f:write("// Implements a Push() and GetStackValue() function for each class exported to the Lua API.\n")
+ f:write("// This file expects to be included form inside the cLuaState class definition\n")
+ f:write("\n\n\n\n\n")
+ for _, item in ipairs(types) do
+ f:write("void Push(" .. item.name .. " * a_Value);\n")
+ end
+ for _, item in ipairs(types) do
+ f:write("void GetStackValue(int a_StackPos, Ptr" .. item.lname .. " & a_ReturnedVal);\n")
+ end
+ f:write("\n\n\n\n\n")
+ f:close()
+ end
+
+ -- Output the Push() and GetStackValue() function implementations:
+ do
+ local f = assert(io.open("LuaState_Implementation.cpp", "w"))
+ f:write("\n// LuaState_Implementation.cpp\n\n// This file is generated along with the Lua bindings by ToLua. Do not edit manually, do not commit to repo.\n")
+ f:write("// Implements a Push() and GetStackValue() function for each class exported to the Lua API.\n")
+ f:write("// This file expects to be compiled as a separate translation unit\n")
+ f:write("\n\n\n\n\n")
+ f:write("#include \"Globals.h\"\n#include \"LuaState.h\"\n#include \"tolua++/include/tolua++.h\"\n")
+ f:write("\n\n\n\n\n")
+ for _, item in ipairs(types) do
+ if not(g_HasCustomPushImplementation[item.name]) then
+ f:write("void cLuaState::Push(" .. item.name .. " * a_Value)\n{\n\tASSERT(IsValid());\n")
+ f:write("\ttolua_pushusertype(m_LuaState, a_Value, \"" .. item.name .. "\");\n");
+ f:write("\tm_NumCurrentFunctionArgs += 1;\n")
+ f:write("}\n\n\n\n\n\n")
+ end
+ end
+ for _, item in ipairs(types) do
+ f:write("void cLuaState::GetStackValue(int a_StackPos, Ptr" .. item.lname .. " & a_ReturnedVal)\n{\n\tASSERT(IsValid());\n")
+ f:write("\tif (lua_isnil(m_LuaState, a_StackPos))\n\t{\n")
+ f:write("\t a_ReturnedVal = nullptr;\n")
+ f:write("\t return;\n\t}\n")
+ f:write("\ttolua_Error err;\n")
+ f:write("\tif (tolua_isusertype(m_LuaState, a_StackPos, \"" .. item.name .. "\", false, &err))\n")
+ f:write("\t{\n")
+ f:write("\t a_ReturnedVal = *(reinterpret_cast<" .. item.name .. " **>(lua_touserdata(m_LuaState, a_StackPos)));\n")
+ f:write("\t}\n")
+ f:write("}\n\n\n\n\n\n")
+ end
+ f:close()
+ end
+end
+
+
+
+
+
+function pre_output_hook(a_Package)
+ OutputLuaStateHelpers(a_Package)
+end
+
+
+
+
+
+function post_output_hook()
+ print("Bindings have been generated.")
+end
+
+
+
+
diff --git a/src/Bindings/CMakeLists.txt b/src/Bindings/CMakeLists.txt
index 366284fcb..2cc33c21f 100644
--- a/src/Bindings/CMakeLists.txt
+++ b/src/Bindings/CMakeLists.txt
@@ -11,6 +11,7 @@ SET (SRCS
LuaNameLookup.cpp
LuaServerHandle.cpp
LuaState.cpp
+ LuaState_Implementation.cpp
LuaTCPLink.cpp
LuaUDPEndpoint.cpp
LuaWindow.cpp
@@ -31,6 +32,8 @@ SET (HDRS
LuaNameLookup.h
LuaServerHandle.h
LuaState.h
+ LuaState_Declaration.inc
+ LuaState_Typedefs.inc
LuaTCPLink.h
LuaUDPEndpoint.h
LuaWindow.h
@@ -46,12 +49,15 @@ SET (HDRS
set (BINDING_OUTPUTS
${CMAKE_CURRENT_SOURCE_DIR}/Bindings.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Bindings.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/LuaState_Declaration.inc
+ ${CMAKE_CURRENT_SOURCE_DIR}/LuaState_Implementation.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/LuaState_Typedefs.inc
)
set(BINDING_DEPENDENCIES
tolua
- ../Bindings/virtual_method_hooks.lua
../Bindings/AllToLua.pkg
+ ../Bindings/BindingsProcessor.lua
../Bindings/LuaFunctions.h
../Bindings/LuaWindow.h
../Bindings/Plugin.h
@@ -126,7 +132,7 @@ if (NOT MSVC)
OUTPUT ${BINDING_OUTPUTS}
# Regenerate bindings:
- COMMAND tolua -L virtual_method_hooks.lua -o Bindings.cpp -H Bindings.h AllToLua.pkg
+ COMMAND tolua -L BindingsProcessor.lua -o Bindings.cpp -H Bindings.h AllToLua.pkg
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
# add any new generation dependencies here
@@ -134,8 +140,7 @@ if (NOT MSVC)
)
endif ()
-set_source_files_properties(${CMAKE_SOURCE_DIR}/src/Bindings/Bindings.cpp PROPERTIES GENERATED TRUE)
-set_source_files_properties(${CMAKE_SOURCE_DIR}/src/Bindings/Bindings.h PROPERTIES GENERATED TRUE)
+set_source_files_properties(${BINDING_OUTPUTS} PROPERTIES GENERATED TRUE)
set_source_files_properties(${CMAKE_SOURCE_DIR}/src/Bindings/Bindings.cpp PROPERTIES COMPILE_FLAGS -Wno-error)
diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp
index fb02569c9..f58047131 100644
--- a/src/Bindings/LuaState.cpp
+++ b/src/Bindings/LuaState.cpp
@@ -530,42 +530,6 @@ void cLuaState::Push(bool a_Value)
-void cLuaState::Push(cBlockEntity * a_BlockEntity)
-{
- ASSERT(IsValid());
-
- tolua_pushusertype(m_LuaState, a_BlockEntity, (a_BlockEntity == nullptr) ? "cBlockEntity" : a_BlockEntity->GetClass());
- m_NumCurrentFunctionArgs += 1;
-}
-
-
-
-
-
-void cLuaState::Push(cChunkDesc * a_ChunkDesc)
-{
- ASSERT(IsValid());
-
- 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());
@@ -632,42 +596,6 @@ void cLuaState::Push(cEntity * a_Entity)
-void cLuaState::Push(cHopperEntity * a_Hopper)
-{
- ASSERT(IsValid());
-
- tolua_pushusertype(m_LuaState, a_Hopper, "cHopperEntity");
- m_NumCurrentFunctionArgs += 1;
-}
-
-
-
-
-
-void cLuaState::Push(cItem * a_Item)
-{
- ASSERT(IsValid());
-
- tolua_pushusertype(m_LuaState, a_Item, "cItem");
- m_NumCurrentFunctionArgs += 1;
-}
-
-
-
-
-
-void cLuaState::Push(cItems * a_Items)
-{
- ASSERT(IsValid());
-
- tolua_pushusertype(m_LuaState, a_Items, "cItems");
- m_NumCurrentFunctionArgs += 1;
-}
-
-
-
-
-
void cLuaState::Push(cLuaServerHandle * a_ServerHandle)
{
ASSERT(IsValid());
@@ -704,126 +632,6 @@ void cLuaState::Push(cLuaUDPEndpoint * a_UDPEndpoint)
-void cLuaState::Push(cMonster * a_Monster)
-{
- ASSERT(IsValid());
-
- tolua_pushusertype(m_LuaState, a_Monster, "cMonster");
- m_NumCurrentFunctionArgs += 1;
-}
-
-
-
-
-
-void cLuaState::Push(cPickup * a_Pickup)
-{
- ASSERT(IsValid());
-
- tolua_pushusertype(m_LuaState, a_Pickup, "cPickup");
- m_NumCurrentFunctionArgs += 1;
-}
-
-
-
-
-
-void cLuaState::Push(cPlayer * a_Player)
-{
- ASSERT(IsValid());
-
- tolua_pushusertype(m_LuaState, a_Player, "cPlayer");
- m_NumCurrentFunctionArgs += 1;
-}
-
-
-
-
-
-void cLuaState::Push(cPlugin * a_Plugin)
-{
- ASSERT(IsValid());
-
- tolua_pushusertype(m_LuaState, a_Plugin, "cPlugin");
- m_NumCurrentFunctionArgs += 1;
-}
-
-
-
-
-
-void cLuaState::Push(cPluginLua * a_Plugin)
-{
- ASSERT(IsValid());
-
- tolua_pushusertype(m_LuaState, a_Plugin, "cPluginLua");
- m_NumCurrentFunctionArgs += 1;
-}
-
-
-
-
-
-void cLuaState::Push(cProjectileEntity * a_ProjectileEntity)
-{
- ASSERT(IsValid());
-
- tolua_pushusertype(m_LuaState, a_ProjectileEntity, "cProjectileEntity");
- m_NumCurrentFunctionArgs += 1;
-}
-
-
-
-
-
-void cLuaState::Push(cTNTEntity * a_TNTEntity)
-{
- ASSERT(IsValid());
-
- tolua_pushusertype(m_LuaState, a_TNTEntity, "cTNTEntity");
- m_NumCurrentFunctionArgs += 1;
-}
-
-
-
-
-
-void cLuaState::Push(cWebAdmin * a_WebAdmin)
-{
- ASSERT(IsValid());
-
- tolua_pushusertype(m_LuaState, a_WebAdmin, "cWebAdmin");
- m_NumCurrentFunctionArgs += 1;
-}
-
-
-
-
-
-void cLuaState::Push(cWindow * a_Window)
-{
- ASSERT(IsValid());
-
- tolua_pushusertype(m_LuaState, a_Window, "cWindow");
- m_NumCurrentFunctionArgs += 1;
-}
-
-
-
-
-
-void cLuaState::Push(cWorld * a_World)
-{
- ASSERT(IsValid());
-
- tolua_pushusertype(m_LuaState, a_World, "cWorld");
- m_NumCurrentFunctionArgs += 1;
-}
-
-
-
-
-
void cLuaState::Push(double a_Value)
{
ASSERT(IsValid());
@@ -848,42 +656,6 @@ void cLuaState::Push(int a_Value)
-void cLuaState::Push(TakeDamageInfo * a_TDI)
-{
- ASSERT(IsValid());
-
- tolua_pushusertype(m_LuaState, a_TDI, "TakeDamageInfo");
- m_NumCurrentFunctionArgs += 1;
-}
-
-
-
-
-
-void cLuaState::Push(Vector3d * a_Vector)
-{
- ASSERT(IsValid());
-
- tolua_pushusertype(m_LuaState, a_Vector, "Vector3<double>");
- m_NumCurrentFunctionArgs += 1;
-}
-
-
-
-
-
-void cLuaState::Push(Vector3i * a_Vector)
-{
- ASSERT(IsValid());
-
- tolua_pushusertype(m_LuaState, a_Vector, "Vector3<int>");
- m_NumCurrentFunctionArgs += 1;
-}
-
-
-
-
-
void cLuaState::Push(void * a_Ptr)
{
UNUSED(a_Ptr);
@@ -899,6 +671,10 @@ void cLuaState::Push(void * a_Ptr)
m_NumCurrentFunctionArgs += 1;
}
+
+
+
+
void cLuaState::Push(std::chrono::milliseconds a_Value)
{
ASSERT(IsValid());
@@ -911,6 +687,7 @@ void cLuaState::Push(std::chrono::milliseconds a_Value)
+/*
void cLuaState::PushUserType(void * a_Object, const char * a_Type)
{
ASSERT(IsValid());
@@ -918,6 +695,7 @@ void cLuaState::PushUserType(void * a_Object, const char * a_Type)
tolua_pushusertype(m_LuaState, a_Object, a_Type);
m_NumCurrentFunctionArgs += 1;
}
+*/
@@ -1031,149 +809,6 @@ void cLuaState::GetStackValue(int a_StackPos, int & a_ReturnedVal)
-void cLuaState::GetStackValue(int a_StackPos, pBlockArea & a_ReturnedVal)
-{
- if (lua_isnil(m_LuaState, a_StackPos))
- {
- a_ReturnedVal = nullptr;
- return;
- }
- tolua_Error err;
- if (tolua_isusertype(m_LuaState, a_StackPos, "cBlockArea", false, &err))
- {
- a_ReturnedVal = *(reinterpret_cast<cBlockArea **>(lua_touserdata(m_LuaState, a_StackPos)));
- }
-}
-
-
-
-
-
-void cLuaState::GetStackValue(int a_StackPos, pBoundingBox & a_ReturnedVal)
-{
- if (lua_isnil(m_LuaState, a_StackPos))
- {
- a_ReturnedVal = nullptr;
- return;
- }
- tolua_Error err;
- if (tolua_isusertype(m_LuaState, a_StackPos, "cBoundingBox", false, &err))
- {
- a_ReturnedVal = *(reinterpret_cast<cBoundingBox **>(lua_touserdata(m_LuaState, a_StackPos)));
- }
-}
-
-
-
-
-
-void cLuaState::GetStackValue(int a_StackPos, pMapManager & a_ReturnedVal)
-{
- if (lua_isnil(m_LuaState, a_StackPos))
- {
- a_ReturnedVal = nullptr;
- return;
- }
- tolua_Error err;
- if (tolua_isusertype(m_LuaState, a_StackPos, "cMapManager", false, &err))
- {
- a_ReturnedVal = *(reinterpret_cast<cMapManager **>(lua_touserdata(m_LuaState, a_StackPos)));
- }
-}
-
-
-
-
-
-void cLuaState::GetStackValue(int a_StackPos, pPluginManager & a_ReturnedVal)
-{
- if (lua_isnil(m_LuaState, a_StackPos))
- {
- a_ReturnedVal = nullptr;
- return;
- }
- tolua_Error err;
- if (tolua_isusertype(m_LuaState, a_StackPos, "cPluginManager", false, &err))
- {
- a_ReturnedVal = *(reinterpret_cast<cPluginManager **>(lua_touserdata(m_LuaState, a_StackPos)));
- }
-}
-
-
-
-
-
-void cLuaState::GetStackValue(int a_StackPos, pRoot & a_ReturnedVal)
-{
- if (lua_isnil(m_LuaState, a_StackPos))
- {
- a_ReturnedVal = nullptr;
- return;
- }
- tolua_Error err;
- if (tolua_isusertype(m_LuaState, a_StackPos, "cRoot", false, &err))
- {
- a_ReturnedVal = *(reinterpret_cast<cRoot **>(lua_touserdata(m_LuaState, a_StackPos)));
- }
-}
-
-
-
-
-
-void cLuaState::GetStackValue(int a_StackPos, pScoreboard & a_ReturnedVal)
-{
- if (lua_isnil(m_LuaState, a_StackPos))
- {
- a_ReturnedVal = nullptr;
- return;
- }
- tolua_Error err;
- if (tolua_isusertype(m_LuaState, a_StackPos, "cScoreboard", false, &err))
- {
- a_ReturnedVal = *(reinterpret_cast<cScoreboard **>(lua_touserdata(m_LuaState, a_StackPos)));
- }
-}
-
-
-
-
-
-void cLuaState::GetStackValue(int a_StackPos, pWorld & a_ReturnedVal)
-{
- if (lua_isnil(m_LuaState, a_StackPos))
- {
- a_ReturnedVal = nullptr;
- return;
- }
- tolua_Error err;
- if (tolua_isusertype(m_LuaState, a_StackPos, "cWorld", false, &err))
- {
- a_ReturnedVal = *(reinterpret_cast<cWorld **>(lua_touserdata(m_LuaState, a_StackPos)));
- }
-}
-
-
-
-
-
-void cLuaState::GetStackValue(int a_StackPos, pClientHandle & a_ReturnedVal)
-{
- if (lua_isnil(m_LuaState, a_StackPos))
- {
- a_ReturnedVal = nullptr;
- return;
- }
- tolua_Error err;
- if (tolua_isusertype(m_LuaState, a_StackPos, "cClientHandle", false, &err))
- {
- a_ReturnedVal = *(reinterpret_cast<cClientHandle **>(lua_touserdata(m_LuaState, a_StackPos)));
- }
-}
-
-
-
-
bool cLuaState::CallFunction(int a_NumResults)
{
ASSERT (m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first
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(),
diff --git a/src/Bindings/virtual_method_hooks.lua b/src/Bindings/virtual_method_hooks.lua
deleted file mode 100644
index 14b0bcae5..000000000
--- a/src/Bindings/virtual_method_hooks.lua
+++ /dev/null
@@ -1,44 +0,0 @@
-
--- virtual_method_hooks.lua
-
--- Implements additional processing that is done while generating the Lua bindings
-
-
-
-
-
-local access = {public = 0, protected = 1, private = 2}
-
-
-
-
-
-function parser_hook(s)
- local container = classContainer.curr -- get the current container
-
- -- process access-specifying labels (public, private, etc)
- do
- local b, e, label = string.find(s, "^%s*(%w*)%s*:[^:]") -- we need to check for [^:], otherwise it would match 'namespace::type'
- if b then
-
- -- found a label, get the new access value from the global 'access' table
- if access[label] then
- container.curr_member_access = access[label]
- end -- else ?
-
- return strsub(s, e) -- normally we would use 'e+1', but we need to preserve the [^:]
- end
- end
-end
-
-
-
-
-
-function post_output_hook()
- print("Bindings have been generated.")
-end
-
-
-
-