summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/BLua.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/includes/BLua.h b/includes/BLua.h
index a6dd2bc..8756f0f 100644
--- a/includes/BLua.h
+++ b/includes/BLua.h
@@ -263,20 +263,32 @@ struct lua_functypes_t {
String("__") + classname##_methods[enumvar].name, \
sLua_##classname::method_##enumvar)
+#define PUSH_CLASS(classname) \
+ bool constructorPushed = false; \
+{ \
+ L.newtable(); \
+ L.push(#classname); \
+ L.copy(-2); \
+ L.setvar(); \
+}
+
#define PUSH_CONSTRUCTOR(classname, enumvar) \
bool constructorPushed = true; \
+{ \
L.newtable(); \
L.push(#classname); \
L.copy(-2); \
L.setvar(); \
- L.declareFunc("new", sLua_##classname::constructor, -1)
+ L.declareFunc("new", sLua_##classname::constructor, -1); \
+}
-#define PUSH_STATIC(classname, enumvar) \
+#define PUSH_STATIC(classname, enumvar) { \
AAssert(constructorPushed, "Please call PUSH_CONSTRUCTOR first"); \
L.declareFunc( \
classname##_functions[enumvar].name, \
sLua_##classname::static_##enumvar, \
- -1)
+ -1); \
+}
#define PUSH_FUNCTION(classname, enumvar) L.declareFunc( \
classname##_functions[enumvar].name, \