From de46b91a524c5f2c8e72b379f2900afe34ccb815 Mon Sep 17 00:00:00 2001 From: chai Date: Thu, 11 Nov 2021 10:29:17 +0800 Subject: *misc --- Runtime/Lua/LuaBind/LuaBindLFunction.h | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'Runtime/Lua/LuaBind/LuaBindLFunction.h') diff --git a/Runtime/Lua/LuaBind/LuaBindLFunction.h b/Runtime/Lua/LuaBind/LuaBindLFunction.h index 1ad6fa0..5c4346b 100644 --- a/Runtime/Lua/LuaBind/LuaBindLFunction.h +++ b/Runtime/Lua/LuaBind/LuaBindLFunction.h @@ -3,19 +3,29 @@ namespace LuaBind { - struct LuaFunction : public GlobalInvoker + struct LuaFunction { const char* method; // full name - LuaFunction(lua_State* L, const char* func) - : GlobalInvoker(L) - , method(func) - {} + LuaFunction(const char* func=NULL); + void operator = (const char* func); - void Invoke(int nReturns) override - { + void AddInt(State& state, int n); + void AddFloat(State& state, float n); + void AddNil(State& state); + void AddBool(State& state, bool b); + void AddString(State& state, const char* str); + void AddTable(State& state, INativeTable& tb); + template + void AddUserdata(State& state, NativeClass& udata) { + udata.PushUserdata(state); + ++argc; + } - } + void Invoke(State& state, int nReturns); + + private: + int argc; }; } \ No newline at end of file -- cgit v1.1-26-g67d0