diff options
author | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2013-07-31 06:44:52 +0200 |
---|---|---|
committer | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2013-07-31 06:44:52 +0200 |
commit | fd192780b998f46dac8d192ba68666bb5d8db73d (patch) | |
tree | 00b5dd8a1efb7bfc6db03966f17b7ac2e0313cdc /includes/BLua.h | |
parent | a5e99a1f0106e6cfc4f3d384e76af393b91c2c08 (diff) |
Few more tweaks to the Lua push system.
Diffstat (limited to 'includes/BLua.h')
-rw-r--r-- | includes/BLua.h | 18 |
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, \ |