diff options
Diffstat (limited to 'libs/lua/LuaBridge/detail/Stack.h')
-rw-r--r-- | libs/lua/LuaBridge/detail/Stack.h | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/libs/lua/LuaBridge/detail/Stack.h b/libs/lua/LuaBridge/detail/Stack.h index 2914e7432e..a569093ad1 100644 --- a/libs/lua/LuaBridge/detail/Stack.h +++ b/libs/lua/LuaBridge/detail/Stack.h @@ -2,6 +2,7 @@ /* https://github.com/vinniefalco/LuaBridge + Copyright 2016, Robin Gareus <robin@gareus.org> Copyright 2012, Vinnie Falco <vinnie.falco@gmail.com> Copyright 2007, Nathan Reed @@ -283,6 +284,70 @@ struct Stack <unsigned long const&> //------------------------------------------------------------------------------ /** + Stack specialization for `long long`. +*/ +template <> +struct Stack <long long> +{ + static inline void push (lua_State* L, long long value) + { + lua_pushinteger (L, static_cast <lua_Integer> (value)); + } + + static inline long long get (lua_State* L, int index) + { + return static_cast <long long> (luaL_checkinteger (L, index)); + } +}; + +template <> +struct Stack <long long const&> +{ + static inline void push (lua_State* L, long long value) + { + lua_pushnumber (L, static_cast <lua_Number> (value)); + } + + static inline long long get (lua_State* L, int index) + { + return static_cast <long long> (luaL_checknumber (L, index)); + } +}; + +//------------------------------------------------------------------------------ +/** + Stack specialization for `unsigned long long`. +*/ +template <> +struct Stack <unsigned long long> +{ + static inline void push (lua_State* L, unsigned long long value) + { + lua_pushinteger (L, static_cast <lua_Integer> (value)); + } + + static inline unsigned long long get (lua_State* L, int index) + { + return static_cast <unsigned long long> (luaL_checkinteger (L, index)); + } +}; + +template <> +struct Stack <unsigned long long const&> +{ + static inline void push (lua_State* L, unsigned long long value) + { + lua_pushnumber (L, static_cast <lua_Number> (value)); + } + + static inline unsigned long long get (lua_State* L, int index) + { + return static_cast <unsigned long long> (luaL_checknumber (L, index)); + } +}; + +//------------------------------------------------------------------------------ +/** Stack specialization for `float`. */ template <> |