diff options
author | chai <chaifix@163.com> | 2021-11-10 19:49:15 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-11-10 19:49:15 +0800 |
commit | f706f0e17ac2e7893feddc96b496db89f35e94a8 (patch) | |
tree | 5daa1df2c19ced5518efb57ab70e5def78b243e2 /Runtime | |
parent | fd646350b566dbe274b65b775029bd45b05e22bd (diff) |
*misc
Diffstat (limited to 'Runtime')
-rw-r--r-- | Runtime/Lua/LuaBind/LuaBindInvoker.cpp | 4 | ||||
-rw-r--r-- | Runtime/Lua/LuaBind/LuaBindInvoker.h | 12 | ||||
-rw-r--r-- | Runtime/Lua/LuaBind/LuaBindLFunction.h | 21 |
3 files changed, 27 insertions, 10 deletions
diff --git a/Runtime/Lua/LuaBind/LuaBindInvoker.cpp b/Runtime/Lua/LuaBind/LuaBindInvoker.cpp index a95ef5c..bd12e5c 100644 --- a/Runtime/Lua/LuaBind/LuaBindInvoker.cpp +++ b/Runtime/Lua/LuaBind/LuaBindInvoker.cpp @@ -43,9 +43,9 @@ namespace LuaBind { method.PushRef(state); state.Call(argc, nReturns, onErrorOccured); + argc = 0; } - - + void MemberInvoker::AddInt(int n) { state.Push(n); diff --git a/Runtime/Lua/LuaBind/LuaBindInvoker.h b/Runtime/Lua/LuaBind/LuaBindInvoker.h index edb0725..45a4e63 100644 --- a/Runtime/Lua/LuaBind/LuaBindInvoker.h +++ b/Runtime/Lua/LuaBind/LuaBindInvoker.h @@ -11,13 +11,9 @@ namespace LuaBind // 调用全局lua方法 struct GlobalInvoker { - GlobalInvoker(lua_State* st) - : state(st) - { - argc = 0; - } - UniversalRef method; + UniversalRef method; + GlobalInvoker(lua_State* st) : state(st), argc(0) {} void AddInt(int n); void AddFloat(float n); void AddNil(); @@ -30,9 +26,9 @@ namespace LuaBind ++argc; } - void Invoke(int nReturns); + virtual void Invoke(int nReturns); - private: + protected: State state; int argc; }; diff --git a/Runtime/Lua/LuaBind/LuaBindLFunction.h b/Runtime/Lua/LuaBind/LuaBindLFunction.h new file mode 100644 index 0000000..1ad6fa0 --- /dev/null +++ b/Runtime/Lua/LuaBind/LuaBindLFunction.h @@ -0,0 +1,21 @@ +#pragma once
+#include "LuaBindInvoker.h"
+
+namespace LuaBind
+{
+ struct LuaFunction : public GlobalInvoker
+ {
+ const char* method; // full name
+
+ LuaFunction(lua_State* L, const char* func)
+ : GlobalInvoker(L)
+ , method(func)
+ {}
+
+ void Invoke(int nReturns) override
+ {
+
+ }
+ };
+
+}
\ No newline at end of file |