From fb7ae1149a80a22c77014d0ece33f6f4b965b631 Mon Sep 17 00:00:00 2001 From: chai Date: Sun, 31 Mar 2019 14:34:40 +0800 Subject: *misc --- source/3rd-party/Luax/luax_class.hpp | 5 ++++- source/3rd-party/Luax/luax_state.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'source/3rd-party') diff --git a/source/3rd-party/Luax/luax_class.hpp b/source/3rd-party/Luax/luax_class.hpp index 08b4e3f..e056b75 100644 --- a/source/3rd-party/Luax/luax_class.hpp +++ b/source/3rd-party/Luax/luax_class.hpp @@ -44,7 +44,7 @@ namespace Luax #define LUAX_DECL_METHOD(mtd) static int mtd(lua_State* L) -#define LUAX_DECL_ENUM(e) +#define LUAX_DECL_ENUM(e, under_line_index) static void _luax_decl_enum_##e() /// /// 标明方法实现的宏。上下文里有一个L。 @@ -62,6 +62,7 @@ namespace Luax /// #define LUAX_REGISTER_FACTORY(state, type) state.RegisterFactory() #define LUAX_REGISTER_SINGLETON(state, type) state.RegisterSingleton() +#define LUAX_REGISTER_ABSTRACT_FACTORY(state, type) type::RegisterLuaxPostprocess(state) #define LUAX_REGISTER_METHODS(state, ...) \ do{ \ luaL_Reg __m[] = {__VA_ARGS__,{0, 0}}; \ @@ -77,6 +78,8 @@ namespace Luax LUAX_STATE(L); \ T* self = state.GetUserdata(1); +#define LUAX_INHERIT(state, type) type::RegisterLuaxClass(state) + /// /// 虚基类,为了实现多态。需要访问下面这些接口的外部基类需要虚继承此类,之后再派生链中就会 /// 调用对应实体的方法。注意继承此类时不能实现下面的方法,实现在LuaxNativeClass中,实现会 diff --git a/source/3rd-party/Luax/luax_state.cpp b/source/3rd-party/Luax/luax_state.cpp index 3eae1df..612f26e 100644 --- a/source/3rd-party/Luax/luax_state.cpp +++ b/source/3rd-party/Luax/luax_state.cpp @@ -314,7 +314,7 @@ namespace Luax lua_gettable(mState, idx); } - std::string LuaxState::GetField(int idx, cc8* key, cc8* value) + std::string LuaxState::GetField(int idx, cc8* key, cc8* default_value) { std::string str; if (this->GetFieldWithType(idx, key, LUA_TSTRING)) { @@ -322,12 +322,12 @@ namespace Luax lua_pop(mState, 1); } else { - str = value; + str = default_value; } return str; } - std::string LuaxState::GetField(int idx, int key, cc8* value) + std::string LuaxState::GetField(int idx, int key, cc8* default_value) { std::string str; if (this->GetFieldWithType(idx, key, LUA_TSTRING)) { @@ -335,7 +335,7 @@ namespace Luax lua_pop(mState, 1); } else { - str = value; + str = default_value; } return str; } -- cgit v1.1-26-g67d0