23 #ifndef LUAVALUECASTS_H
24 #define LUAVALUECASTS_H
102 typename std::enable_if<std::is_enum<T>::value,
int>::type
106 typename std::enable_if<std::is_enum<T>::value,
bool>::type
111 typename std::enable_if<std::is_base_of<LuaObject, typename T::element_type>::value,
int>::type
117 typename std::enable_if<std::is_base_of<LuaObject, T>::value,
bool>::type
121 template<
typename Ret,
typename... Args>
124 template<
typename... Args>
125 bool luavalue_cast(
int index, std::function<
void(Args...)>& func);
127 template<
typename Ret,
typename... Args>
128 typename std::enable_if<!std::is_void<Ret>::value,
bool>::type
153 template<
class K,
class V>
156 template<
class K,
class V>
160 template<
typename... Args>
163 template<
typename... Args>
178 typename std::enable_if<std::is_enum<T>::value,
bool>::type
189 typename std::enable_if<std::is_base_of<LuaObject, typename T::element_type>::value,
int>::type
199 typename std::enable_if<std::is_base_of<LuaObject, T>::value,
bool>::type
205 ptr = obj->dynamic_self_cast<T>();
211 template<
typename Ret,
typename... Args>
221 template<
typename... Args>
228 func = [=](Args... args) {
238 throw LuaException(
"attempt to call an expired lua function from C++,"
239 "did you forget to hold a reference for that function?", 0);
247 func = std::function<void(Args...)>();
253 template<
typename Ret,
typename... Args>
254 typename std::enable_if<!std::is_void<Ret>::value,
bool>::type
261 func = [=](Args... args) -> Ret {
269 throw LuaException(
"a function from lua didn't retrieve the expected number of results", 0);
272 throw LuaException(
"attempt to call an expired lua function from C++,"
273 "did you forget to hold a reference for that function?", 0);
282 func = std::function<Ret(Args...)>();
292 for(
const T& v : list) {
305 while(
g_lua.
next(index < 0 ? index-1 : index)) {
308 list.push_back(value);
320 for(
const T& v : vec) {
333 while(
g_lua.
next(index < 0 ? index-1 : index)) {
336 vec.push_back(value);
348 for(
const T& v : vec) {
361 while(
g_lua.
next(index < 0 ? index-1 : index)) {
364 vec.push_back(value);
372 template<
class K,
class V>
376 for(
auto& it : map) {
384 template<
class K,
class V>
389 while(
g_lua.
next(index < 0 ? index-1 : index)) {
404 template<
typename Tuple>
405 static void call(
const Tuple& tuple) {
414 template<
typename Tuple>
415 static void call(
const Tuple& tuple) { }
418 template<
typename... Args>
427 template<
typename Tuple>
428 static void call(
const Tuple& tuple) {
436 template<
typename Tuple>
437 static void call(
const Tuple& tuple) { }
440 template<
typename... Args>
443 return sizeof...(Args);