summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdwin Mons <edwin.mons@isode.com>2014-12-10 16:50:27 (GMT)
committerSwift Review <review@swift.im>2014-12-14 14:47:01 (GMT)
commit6948ef81d66680858b88b1bc7dc67687310f57cf (patch)
tree3aeb638051bfac666924b7479ff201e095ae048c /Sluift/ElementConvertors
parentb4a54583c4d575fe152122c21da616c3c942bbfd (diff)
downloadswift-6948ef81d66680858b88b1bc7dc67687310f57cf.zip
swift-6948ef81d66680858b88b1bc7dc67687310f57cf.tar.bz2
Add index element to ResultSet
The index element was missing, added it in Swiften and Sluift. Change-Id: I709037fafcc5242c7c2e2fddb8469316c106d51a
Diffstat (limited to 'Sluift/ElementConvertors')
-rw-r--r--Sluift/ElementConvertors/ResultSetConvertor.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/Sluift/ElementConvertors/ResultSetConvertor.cpp b/Sluift/ElementConvertors/ResultSetConvertor.cpp
index bd517b3..f5df2bd 100644
--- a/Sluift/ElementConvertors/ResultSetConvertor.cpp
+++ b/Sluift/ElementConvertors/ResultSetConvertor.cpp
@@ -33,6 +33,11 @@ boost::shared_ptr<ResultSet> ResultSetConvertor::doConvertFromLua(lua_State* L)
result->setCount(boost::numeric_cast<int>(lua_tonumber(L, -1)));
}
lua_pop(L, 1);
+ lua_getfield(L, -1, "index");
+ if (lua_isnumber(L, -1)) {
+ result->setIndex(boost::numeric_cast<int>(lua_tonumber(L, -1)));
+ }
+ lua_pop(L, 1);
lua_getfield(L, -1, "first_id_index");
if (lua_isstring(L, -1)) {
result->setFirstIDIndex(boost::numeric_cast<int>(lua_tonumber(L, -1)));
@@ -71,6 +76,10 @@ void ResultSetConvertor::doConvertToLua(lua_State* L, boost::shared_ptr<ResultSe
lua_pushnumber(L, *payload->getCount());
lua_setfield(L, -2, "count");
}
+ if (payload->getIndex()) {
+ lua_pushnumber(L, *payload->getIndex());
+ lua_setfield(L, -2, "index");
+ }
if (payload->getFirstIDIndex()) {
lua_pushnumber(L, *payload->getFirstIDIndex());
lua_setfield(L, -2, "first_id_index");