summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2016-06-12 18:24:01 +0200
committerMattes D <github@xoft.cz>2016-06-27 20:51:52 +0200
commit7a6670d1d110be96ed73ccab4f33c69e4a01f28d (patch)
treed85a6aa0d3c01d730d47c3b0306ea837c9704b4c
parentcPluginManager: Use a callback for command handler registration. (diff)
downloadcuberite-7a6670d1d110be96ed73ccab4f33c69e4a01f28d.tar
cuberite-7a6670d1d110be96ed73ccab4f33c69e4a01f28d.tar.gz
cuberite-7a6670d1d110be96ed73ccab4f33c69e4a01f28d.tar.bz2
cuberite-7a6670d1d110be96ed73ccab4f33c69e4a01f28d.tar.lz
cuberite-7a6670d1d110be96ed73ccab4f33c69e4a01f28d.tar.xz
cuberite-7a6670d1d110be96ed73ccab4f33c69e4a01f28d.tar.zst
cuberite-7a6670d1d110be96ed73ccab4f33c69e4a01f28d.zip
-rw-r--r--src/Bindings/LuaState.cpp4
-rw-r--r--src/Bindings/LuaState.h10
-rw-r--r--src/Bindings/PluginLua.cpp26
-rw-r--r--src/Bindings/PluginLua.h6
4 files changed, 3 insertions, 43 deletions
diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp
index 0d958cc20..109809cab 100644
--- a/src/Bindings/LuaState.cpp
+++ b/src/Bindings/LuaState.cpp
@@ -553,7 +553,7 @@ bool cLuaState::PushFunction(const char * a_FunctionName)
-bool cLuaState::PushFunction(int a_FnRef)
+bool cLuaState::PushFunction(const cRef & a_FnRef)
{
ASSERT(IsValid());
ASSERT(m_NumCurrentFunctionArgs == -1); // If not, there's already something pushed onto the stack
@@ -561,7 +561,7 @@ bool cLuaState::PushFunction(int a_FnRef)
// Push the error handler for lua_pcall()
lua_pushcfunction(m_LuaState, &ReportFnCallErrors);
- lua_rawgeti(m_LuaState, LUA_REGISTRYINDEX, a_FnRef); // same as lua_getref()
+ lua_rawgeti(m_LuaState, LUA_REGISTRYINDEX, static_cast<int>(a_FnRef)); // same as lua_getref()
if (!lua_isfunction(m_LuaState, -1))
{
lua_pop(m_LuaState, 2);
diff --git a/src/Bindings/LuaState.h b/src/Bindings/LuaState.h
index 88313f9fb..d3acb2797 100644
--- a/src/Bindings/LuaState.h
+++ b/src/Bindings/LuaState.h
@@ -640,18 +640,10 @@ protected:
*/
bool PushFunction(const char * a_FunctionName);
- /** Pushes a function that has been saved into the global registry, identified by a_FnRef.
- Returns true if successful. Logs a warning on failure
- */
- bool PushFunction(int a_FnRef);
-
/** Pushes a function that has been saved as a reference.
Returns true if successful. Logs a warning on failure
*/
- bool PushFunction(const cRef & a_FnRef)
- {
- return PushFunction(static_cast<int>(a_FnRef));
- }
+ bool PushFunction(const cRef & a_FnRef);
/** Pushes a function that is stored in a referenced table by name
Returns true if successful. Logs a warning on failure
diff --git a/src/Bindings/PluginLua.cpp b/src/Bindings/PluginLua.cpp
index ee0d289a1..07d0a7526 100644
--- a/src/Bindings/PluginLua.cpp
+++ b/src/Bindings/PluginLua.cpp
@@ -1140,32 +1140,6 @@ int cPluginLua::CallFunctionFromForeignState(
-bool cPluginLua::CallbackWindowClosing(int a_FnRef, cWindow & a_Window, cPlayer & a_Player, bool a_CanRefuse)
-{
- ASSERT(a_FnRef != LUA_REFNIL);
-
- cOperation op(*this);
- bool res = false;
- op().Call(a_FnRef, &a_Window, &a_Player, a_CanRefuse, cLuaState::Return, res);
- return res;
-}
-
-
-
-
-
-void cPluginLua::CallbackWindowSlotChanged(int a_FnRef, cWindow & a_Window, int a_SlotNum)
-{
- ASSERT(a_FnRef != LUA_REFNIL);
-
- cOperation op(*this);
- op().Call(a_FnRef, &a_Window, a_SlotNum);
-}
-
-
-
-
-
void cPluginLua::ClearWebTabs(void)
{
auto webAdmin = cRoot::Get()->GetWebAdmin();
diff --git a/src/Bindings/PluginLua.h b/src/Bindings/PluginLua.h
index 9e6b53e75..e28e30698 100644
--- a/src/Bindings/PluginLua.h
+++ b/src/Bindings/PluginLua.h
@@ -141,12 +141,6 @@ public:
/** Returns true if the plugin contains the function for the specified hook type, using the old-style registration (#121) */
bool CanAddOldStyleHook(int a_HookType);
- /** Calls the plugin-specified "cLuaWindow closing" callback. Returns true only if the callback returned true */
- bool CallbackWindowClosing(int a_FnRef, cWindow & a_Window, cPlayer & a_Player, bool a_CanRefuse);
-
- /** Calls the plugin-specified "cLuaWindow slot changed" callback. */
- void CallbackWindowSlotChanged(int a_FnRef, cWindow & a_Window, int a_SlotNum);
-
/** Returns the name of Lua function that should handle the specified hook type in the older (#121) API */
static const char * GetHookFnName(int a_HookType);