Esempio n. 1
0
	static int l_pack_start(lua_State *l) {
		UI::Box *b = LuaObject<UI::Box>::CheckFromLua(1);
		UI::Context *c = b->GetContext();

		if (lua_istable(l, 2)) {
			UI::Widget *w = UI::Lua::GetWidget(c, l, 2);
			if (w)
				b->PackStart(w);
			else
				for (size_t i = lua_rawlen(l, 2); i > 0; i--) {
					lua_rawgeti(l, 2, i);
					b->PackStart(UI::Lua::CheckWidget(c, l, -1));
					lua_pop(l, 1);
				}
		}
		else
			b->PackStart(UI::Lua::CheckWidget(c, l, 2));

		lua_pushvalue(l, 1);
		return 1;
	}
Esempio n. 2
0
	static int l_pack_start(lua_State *l) {
		UI::Box *b = LuaObject<UI::Box>::CheckFromLua(1);

		if (lua_istable(l, 2)) {
			for (size_t i = lua_rawlen(l, 2); i > 0; i--) {
				lua_rawgeti(l, 2, i);
				b->PackStart(LuaObject<UI::Widget>::CheckFromLua(-1));
				lua_pop(l, 1);
			}
		}
		else
			b->PackEnd(LuaObject<UI::Widget>::CheckFromLua(2));

		lua_pushvalue(l, 1);
		return 1;
	}