diff options
author | Roger Planas <roger.planas@isode.com> | 2017-07-04 11:03:55 (GMT) |
---|---|---|
committer | Roger Planas <roger.planas@isode.com> | 2017-10-30 12:25:43 (GMT) |
commit | c29df10f0ab47db63509634fb1661ff55b8b47b3 (patch) | |
tree | ebf7486b653b554e3122c3509da17e17ef25f312 /Sluift/ElementConvertors | |
parent | ed25c7d2fe46dca4edecd359755b15e16620056e (diff) | |
download | swift-c29df10f0ab47db63509634fb1661ff55b8b47b3.zip swift-c29df10f0ab47db63509634fb1661ff55b8b47b3.tar.bz2 |
Sluift: Add support for Lua 5.3
This patch adds support for Lua 5.3, while keeping support for
Lua 5.1 (a build with the bundled Lua succeeds)
Test-information:
Builds cleanly on Lua 5.1, 5.2 and Lua 5.3.
Tests that make use of Sluift work with both Lua 5.2 and Lua 5.3
Change-Id: I4cbe2eb09ec8c753d8624047f5456be1de72c679
Diffstat (limited to 'Sluift/ElementConvertors')
13 files changed, 15 insertions, 15 deletions
diff --git a/Sluift/ElementConvertors/FormConvertor.cpp b/Sluift/ElementConvertors/FormConvertor.cpp index 90fd9fe..245e0f9 100644 --- a/Sluift/ElementConvertors/FormConvertor.cpp +++ b/Sluift/ElementConvertors/FormConvertor.cpp @@ -29,7 +29,7 @@ namespace { lua_pushnil(L); for (lua_pushnil(L); lua_next(L, index) != 0; ) { lua_getfield(L, -1, "name"); - if (lua_equal(L, -1, 2)) { + if (lua_compare(L, -1, 2, LUA_OPEQ)) { lua_pop(L, 1); return 1; } @@ -44,7 +44,7 @@ namespace { if (lua_type(L, -1) == LUA_TTABLE) { for (lua_pushnil(L); lua_next(L, -2) != 0; ) { lua_getfield(L, -1, "name"); - if (lua_equal(L, -1, 2)) { + if (lua_compare(L, -1, 2, LUA_OPEQ)) { lua_pushvalue(L, 3); lua_setfield(L, -3, "value"); foundField = true; diff --git a/Sluift/ElementConvertors/PubSubAffiliationsConvertor.cpp b/Sluift/ElementConvertors/PubSubAffiliationsConvertor.cpp index c6ba09e..8f8a660 100644 --- a/Sluift/ElementConvertors/PubSubAffiliationsConvertor.cpp +++ b/Sluift/ElementConvertors/PubSubAffiliationsConvertor.cpp @@ -33,7 +33,7 @@ std::shared_ptr<PubSubAffiliations> PubSubAffiliationsConvertor::doConvertFromLu lua_pop(L, 1); if (lua_type(L, -1) == LUA_TTABLE) { std::vector< std::shared_ptr<PubSubAffiliation> > items; - for(size_t i = 0; i < lua_objlen(L, -1); ++i) { + for(size_t i = 0; i < lua_rawlen(L, -1); ++i) { lua_pushnumber(L, i + 1); lua_gettable(L, -2); if (!lua_isnil(L, -1)) { diff --git a/Sluift/ElementConvertors/PubSubEventItemConvertor.cpp b/Sluift/ElementConvertors/PubSubEventItemConvertor.cpp index ac86024..19ab09a 100644 --- a/Sluift/ElementConvertors/PubSubEventItemConvertor.cpp +++ b/Sluift/ElementConvertors/PubSubEventItemConvertor.cpp @@ -39,7 +39,7 @@ std::shared_ptr<PubSubEventItem> PubSubEventItemConvertor::doConvertFromLua(lua_ lua_getfield(L, -1, "data"); if (lua_type(L, -1) == LUA_TTABLE) { std::vector< std::shared_ptr<Payload> > items; - for(size_t i = 0; i < lua_objlen(L, -1); ++i) { + for(size_t i = 0; i < lua_rawlen(L, -1); ++i) { lua_pushnumber(L, i + 1); lua_gettable(L, -2); if (!lua_isnil(L, -1)) { diff --git a/Sluift/ElementConvertors/PubSubEventItemsConvertor.cpp b/Sluift/ElementConvertors/PubSubEventItemsConvertor.cpp index 7a3cde1..66f798e 100644 --- a/Sluift/ElementConvertors/PubSubEventItemsConvertor.cpp +++ b/Sluift/ElementConvertors/PubSubEventItemsConvertor.cpp @@ -34,7 +34,7 @@ std::shared_ptr<PubSubEventItems> PubSubEventItemsConvertor::doConvertFromLua(lu lua_getfield(L, -1, "items"); if (lua_type(L, -1) == LUA_TTABLE) { std::vector< std::shared_ptr<PubSubEventItem> > items; - for(size_t i = 0; i < lua_objlen(L, -1); ++i) { + for(size_t i = 0; i < lua_rawlen(L, -1); ++i) { lua_pushnumber(L, i + 1); lua_gettable(L, -2); if (!lua_isnil(L, -1)) { @@ -51,7 +51,7 @@ std::shared_ptr<PubSubEventItems> PubSubEventItemsConvertor::doConvertFromLua(lu lua_getfield(L, -1, "retracts"); if (lua_type(L, -1) == LUA_TTABLE) { std::vector< std::shared_ptr<PubSubEventRetract> > items; - for(size_t i = 0; i < lua_objlen(L, -1); ++i) { + for(size_t i = 0; i < lua_rawlen(L, -1); ++i) { lua_pushnumber(L, i + 1); lua_gettable(L, -2); if (!lua_isnil(L, -1)) { diff --git a/Sluift/ElementConvertors/PubSubItemConvertor.cpp b/Sluift/ElementConvertors/PubSubItemConvertor.cpp index 27fd4a3..b46419a 100644 --- a/Sluift/ElementConvertors/PubSubItemConvertor.cpp +++ b/Sluift/ElementConvertors/PubSubItemConvertor.cpp @@ -29,7 +29,7 @@ std::shared_ptr<PubSubItem> PubSubItemConvertor::doConvertFromLua(lua_State* L) lua_getfield(L, -1, "data"); if (lua_type(L, -1) == LUA_TTABLE) { std::vector< std::shared_ptr<Payload> > items; - for(size_t i = 0; i < lua_objlen(L, -1); ++i) { + for(size_t i = 0; i < lua_rawlen(L, -1); ++i) { lua_pushnumber(L, i + 1); lua_gettable(L, -2); if (!lua_isnil(L, -1)) { diff --git a/Sluift/ElementConvertors/PubSubItemsConvertor.cpp b/Sluift/ElementConvertors/PubSubItemsConvertor.cpp index 5fa1bd3..0bb8eb9 100644 --- a/Sluift/ElementConvertors/PubSubItemsConvertor.cpp +++ b/Sluift/ElementConvertors/PubSubItemsConvertor.cpp @@ -33,7 +33,7 @@ std::shared_ptr<PubSubItems> PubSubItemsConvertor::doConvertFromLua(lua_State* L lua_pop(L, 1); if (lua_type(L, -1) == LUA_TTABLE) { std::vector< std::shared_ptr<PubSubItem> > items; - for(size_t i = 0; i < lua_objlen(L, -1); ++i) { + for(size_t i = 0; i < lua_rawlen(L, -1); ++i) { lua_pushnumber(L, i + 1); lua_gettable(L, -2); if (!lua_isnil(L, -1)) { diff --git a/Sluift/ElementConvertors/PubSubOwnerAffiliationsConvertor.cpp b/Sluift/ElementConvertors/PubSubOwnerAffiliationsConvertor.cpp index ee8a8cb..9ca76fc 100644 --- a/Sluift/ElementConvertors/PubSubOwnerAffiliationsConvertor.cpp +++ b/Sluift/ElementConvertors/PubSubOwnerAffiliationsConvertor.cpp @@ -33,7 +33,7 @@ std::shared_ptr<PubSubOwnerAffiliations> PubSubOwnerAffiliationsConvertor::doCon lua_pop(L, 1); if (lua_type(L, -1) == LUA_TTABLE) { std::vector< std::shared_ptr<PubSubOwnerAffiliation> > items; - for(size_t i = 0; i < lua_objlen(L, -1); ++i) { + for(size_t i = 0; i < lua_rawlen(L, -1); ++i) { lua_pushnumber(L, i + 1); lua_gettable(L, -2); if (!lua_isnil(L, -1)) { diff --git a/Sluift/ElementConvertors/PubSubOwnerSubscriptionsConvertor.cpp b/Sluift/ElementConvertors/PubSubOwnerSubscriptionsConvertor.cpp index 88085b5..3530efe 100644 --- a/Sluift/ElementConvertors/PubSubOwnerSubscriptionsConvertor.cpp +++ b/Sluift/ElementConvertors/PubSubOwnerSubscriptionsConvertor.cpp @@ -33,7 +33,7 @@ std::shared_ptr<PubSubOwnerSubscriptions> PubSubOwnerSubscriptionsConvertor::doC lua_pop(L, 1); if (lua_type(L, -1) == LUA_TTABLE) { std::vector< std::shared_ptr<PubSubOwnerSubscription> > items; - for(size_t i = 0; i < lua_objlen(L, -1); ++i) { + for(size_t i = 0; i < lua_rawlen(L, -1); ++i) { lua_pushnumber(L, i + 1); lua_gettable(L, -2); if (!lua_isnil(L, -1)) { diff --git a/Sluift/ElementConvertors/PubSubPublishConvertor.cpp b/Sluift/ElementConvertors/PubSubPublishConvertor.cpp index 63c97bc..d8a2742 100644 --- a/Sluift/ElementConvertors/PubSubPublishConvertor.cpp +++ b/Sluift/ElementConvertors/PubSubPublishConvertor.cpp @@ -34,7 +34,7 @@ std::shared_ptr<PubSubPublish> PubSubPublishConvertor::doConvertFromLua(lua_Stat lua_getfield(L, -1, "items"); if (lua_type(L, -1) == LUA_TTABLE) { std::vector< std::shared_ptr<PubSubItem> > items; - for(size_t i = 0; i < lua_objlen(L, -1); ++i) { + for(size_t i = 0; i < lua_rawlen(L, -1); ++i) { lua_pushnumber(L, i + 1); lua_gettable(L, -2); if (!lua_isnil(L, -1)) { diff --git a/Sluift/ElementConvertors/PubSubRetractConvertor.cpp b/Sluift/ElementConvertors/PubSubRetractConvertor.cpp index c070ad6..c27ad7d 100644 --- a/Sluift/ElementConvertors/PubSubRetractConvertor.cpp +++ b/Sluift/ElementConvertors/PubSubRetractConvertor.cpp @@ -34,7 +34,7 @@ std::shared_ptr<PubSubRetract> PubSubRetractConvertor::doConvertFromLua(lua_Stat lua_getfield(L, -1, "items"); if (lua_type(L, -1) == LUA_TTABLE) { std::vector< std::shared_ptr<PubSubItem> > items; - for(size_t i = 0; i < lua_objlen(L, -1); ++i) { + for(size_t i = 0; i < lua_rawlen(L, -1); ++i) { lua_pushnumber(L, i + 1); lua_gettable(L, -2); if (!lua_isnil(L, -1)) { diff --git a/Sluift/ElementConvertors/PubSubSubscriptionsConvertor.cpp b/Sluift/ElementConvertors/PubSubSubscriptionsConvertor.cpp index 3712192..2325181 100644 --- a/Sluift/ElementConvertors/PubSubSubscriptionsConvertor.cpp +++ b/Sluift/ElementConvertors/PubSubSubscriptionsConvertor.cpp @@ -33,7 +33,7 @@ std::shared_ptr<PubSubSubscriptions> PubSubSubscriptionsConvertor::doConvertFrom lua_pop(L, 1); if (lua_type(L, -1) == LUA_TTABLE) { std::vector< std::shared_ptr<PubSubSubscription> > items; - for(size_t i = 0; i < lua_objlen(L, -1); ++i) { + for(size_t i = 0; i < lua_rawlen(L, -1); ++i) { lua_pushnumber(L, i + 1); lua_gettable(L, -2); if (!lua_isnil(L, -1)) { diff --git a/Sluift/ElementConvertors/SecurityLabelConvertor.cpp b/Sluift/ElementConvertors/SecurityLabelConvertor.cpp index 21d9a8f..8bc323a 100644 --- a/Sluift/ElementConvertors/SecurityLabelConvertor.cpp +++ b/Sluift/ElementConvertors/SecurityLabelConvertor.cpp @@ -26,7 +26,7 @@ std::shared_ptr<SecurityLabel> SecurityLabelConvertor::doConvertFromLua(lua_Stat lua_getfield(L, -1, "equivalent_labels"); if (lua_type(L, -1) == LUA_TTABLE) { std::vector< std::string > items; - for(size_t i = 0; i < lua_objlen(L, -1); ++i) { + for(size_t i = 0; i < lua_rawlen(L, -1); ++i) { lua_pushnumber(L, i + 1); lua_gettable(L, -2); if (lua_isstring(L, -1)) { diff --git a/Sluift/ElementConvertors/StanzaConvertor.h b/Sluift/ElementConvertors/StanzaConvertor.h index bdaaad3..a7b4e4e 100644 --- a/Sluift/ElementConvertors/StanzaConvertor.h +++ b/Sluift/ElementConvertors/StanzaConvertor.h @@ -46,7 +46,7 @@ namespace Swift { lua_pop(L, 1); lua_getfield(L, -1, "payloads"); if (lua_type(L, -1) == LUA_TTABLE) { - for(size_t i = 0; i < lua_objlen(L, -1); ++i) { + for(size_t i = 0; i < lua_rawlen(L, -1); ++i) { lua_pushnumber(L, i + 1); lua_gettable(L, -2); if (!lua_isnil(L, -1)) { |