int Value::_newindex(lua_State *L) {

		Value *v = _rawGet(L, 1);

		Value *newVal = get(L, 3);
		if (lua_isstring(L, 2)) {
			const introspection::Type &type = v->getType();
			if (!type.isDefined()) {
				return luaL_error(L, "Type not defined %s",
				                  type.getStdTypeInfo().name());
			}

			const introspection::PropertyInfo * prop = lookupProperty(type, lua_tostring(L, 2));
			if (prop) {
				if (!prop->isSimple()) {
					/// @todo implement other types of properties?
					return luaL_error(L, "Non-simple properties are not yet settable in osgLua");
				} else if (!prop->canSet()) {
					return luaL_error(L, "Property %s defined as not settable", prop->getName().c_str());
				} else {
					std::cout << "Setting a property named " << prop->getName() << std::endl;
					prop->setValue(v->get(), newVal->get());
					return 0;
				}
			}

			return luaL_error(L, "No property '%s' defined in '%s'", lua_tostring(L, 2), type.getQualifiedName().c_str());

		}
		/// @todo error here?
		// maybe ... if is an integer... access indexed data
		return 0;
	}
	int Value::_index(lua_State *L) {
		Value *v = _rawGet(L, 1);
		if (lua_isstring(L, 2)) {
			const introspection::Type &type = v->getType();
			if (!type.isDefined()) {
				return luaL_error(L, "Type not defined '%s'",
				                  type.getStdTypeInfo().name());
			}

			const introspection::PropertyInfo * prop = lookupProperty(type, lua_tostring(L, 2));
			if (prop) {
				if (prop->isArray()) {
					ArrayPropertyProxy::pushNew(L, v->get(), prop);
					return 1;
				} else if (!prop->canGet()) {
					return luaL_error(L, "Property '%s' defined as not gettable", prop->getName().c_str());
				} else {
					introspection::Value propVal = prop->getValue(v->get());
					Value::push(L, propVal);
					return 1;
				}
			}

			// OK, it's not a property, assume it's a method.
			lua_pushvalue(L, 2); // copy the name
			lua_pushcclosure(L, Value::_methodCall, 1);
			return 1;
		}
		// maybe ... if is an integer... access indexed data
		return 0;
	}
QVariant JsonDbSortingListModelPrivate::getItem(int index, int role)
{
    if (index < 0 || index >= objects.size())
        return QVariant();
    QMap<SortingKey, QString>::const_iterator begin = objectUuids.constBegin();
    return lookupProperty(objects.value((begin+index).value()), properties[role]);
}