push deques into lua

This commit is contained in:
Eduardo Bart 2011-09-02 01:21:18 -03:00
parent 80e4bb59d2
commit 6737b0a492
2 changed files with 16 additions and 0 deletions

View File

@ -71,6 +71,7 @@ void LuaInterface::registerFunctions()
g_lua.bindClassMemberFunction<UIWidget>("show", &UIWidget::show);
g_lua.bindClassMemberFunction<UIWidget>("lock", &UIWidget::lock);
g_lua.bindClassMemberFunction<UIWidget>("unlock", &UIWidget::unlock);
g_lua.bindClassMemberFunction<UIWidget>("getChildren", &UIWidget::getChildren);
g_lua.bindClassMemberFunction<UIWidget>("getChildById", &UIWidget::getChildById);
g_lua.bindClassMemberFunction<UIWidget>("getChildByIndex", &UIWidget::getChildByIndex);
g_lua.bindClassMemberFunction<UIWidget>("getChildCount", &UIWidget::getChildCount);

View File

@ -102,6 +102,10 @@ luavalue_cast(int index, std::function<Ret(Args...)>& func);
template<typename T>
void push_luavalue(const std::vector<T>& vec);
// deque
template<class T>
void push_luavalue(const std::deque<T>& vec);
// tuple
template<typename... Args>
void push_luavalue(const std::tuple<Args...>& tuple);
@ -222,6 +226,17 @@ void push_luavalue(const std::vector<T>& vec) {
}
}
template<typename T>
void push_luavalue(const std::deque<T>& vec) {
g_lua.newTable();
int i = 1;
for(const T& v : vec) {
push_luavalue(v);
g_lua.rawSeti(i);
i++;
}
}
template<int N>
struct push_tuple_luavalue {
template<typename Tuple>