summaryrefslogtreecommitdiff
path: root/source/3rd-party/Luax/luax_class.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/3rd-party/Luax/luax_class.hpp')
-rw-r--r--source/3rd-party/Luax/luax_class.hpp25
1 files changed, 21 insertions, 4 deletions
diff --git a/source/3rd-party/Luax/luax_class.hpp b/source/3rd-party/Luax/luax_class.hpp
index ea1fab9..539ff1a 100644
--- a/source/3rd-party/Luax/luax_class.hpp
+++ b/source/3rd-party/Luax/luax_class.hpp
@@ -35,15 +35,32 @@ namespace Luax
static const char* GetLuaxClassName() { return #type; }; \
static bool IsLuaxClassSingleton() { return true; };
+ ///
+ /// ±êÃ÷·½·¨ÊµÏֵĺꡣÉÏÏÂÎÄÀïÓÐÒ»¸öL¡£
+ ///
#define LUAX_IMPL_METHOD(type, f) int type::f(lua_State* L)
+ ///
+ /// ÓÉÓ¦ÓóÌÐòʵÏÖµÄÁ½¸ö½Ó¿Ú¡£ÉÏÏÂÎÄÀïÓÐÒ»¸östate¡£
+ ///
#define LUAX_REGISTRY(type) void type::RegisterLuaxClass(Luax::LuaxState& state)
-
#define LUAX_POSTPROCESS(type) void type::RegisterLuaxPostprocess(Luax::LuaxState& state)
-#define LUAX_REGISTER_FACTORY(stt, type) stt.RegisterFactory<type>()
-
-#define LUAX_REGISTER_SINGLETON(stt, type) stt.RegisterSingleton<type>()
+ ///
+ /// ÓÃÀ´×¢²áµÄºê¡£
+ ///
+#define LUAX_REGISTER_FACTORY(state, type) state.RegisterFactory<type>()
+#define LUAX_REGISTER_SINGLETON(state, type) state.RegisterSingleton<type>()
+#define LUAX_REGISTER_METHODS(state, ...) \
+ do{ \
+ luaL_Reg __m[] = {__VA_ARGS__,{0, 0}}; \
+ state.RegisterMethods(__m); \
+ }while(0)
+#define LUAX_REGISTER_ENUM(state, name, ...) \
+ do{ \
+ Luax::LuaxEnum __e[] = {__VA_ARGS__,{0, 0}}; \
+ state.RegisterEnum(name, __e); \
+ }while(0)
///
/// ÐèÒª±©Â¶¸øluaµÄnative classÐèÒª¼Ì³Ð´ËÀࡣͨ¹ýlua¹ÜÀíµÄʵÀýҪȷ±£ÒýÓüÆÊýµÄÕýÈ·ÐÔ£¬ÔÚ¶à¸öÏß³ÌÖÐÐèҪȷ¶¨²»»áÎóÊÍ·Å¡£