customize LuaBridge

* introduce boost::shared_ptr support
* support enum & const
* allow to add non-class member functions
* STL iterators (vector, list, set, bitset & map)
* support reference arguments (framecnt_t&)
* add support for arrays of basic types (e.g. float*, int*)
* fix compiler warnings
This commit is contained in:
Robin Gareus 2016-02-21 19:25:42 +01:00
parent 5b40e073e9
commit 12a58015a3
8 changed files with 1137 additions and 23 deletions

View file

@ -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
@ -281,6 +282,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`.