diff options
Diffstat (limited to 'libs/lua/LuaBridge/detail/CFunctions.h')
-rw-r--r-- | libs/lua/LuaBridge/detail/CFunctions.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/libs/lua/LuaBridge/detail/CFunctions.h b/libs/lua/LuaBridge/detail/CFunctions.h index 15bc7022b3..9f1712995a 100644 --- a/libs/lua/LuaBridge/detail/CFunctions.h +++ b/libs/lua/LuaBridge/detail/CFunctions.h @@ -379,6 +379,29 @@ struct CFunc }; + template <class T, class R> + struct CastClass + { + static int f (lua_State* L) + { + T * const t = Userdata::get <T> (L, 1, false ); + Stack <R*>::push (L, dynamic_cast<R*>(t)); + return 1; + } + }; + + template <class T, class R> + struct CastConstClass + { + static int f (lua_State* L) + { + T const* const t = Userdata::get <T> (L, 1, true); + Stack <R const*>::push (L, dynamic_cast<R const*>(t)); + return 1; + } + }; + + template <class T> struct PtrNullCheck { |