[NTG-context] Reverse traversing of xml.collected()?

Gerben Wierda gerben.wierda at rna.nl
Fri May 1 14:06:05 CEST 2020



> On 1 May 2020, at 13:30, Hans Hagen <j.hagen at xs4all.nl> wrote:
> 
> On 5/1/2020 11:31 AM, Gerben Wierda wrote:
>> I’d like to travese the contents of an xml.collected() in a reverse order. I have
>>     for connectionFromXML in xml.collected(viewFromXML,"/connection") do
>>       parseXMLConnection( rootFromXML, connectionFromXML, viewFromXML, rootFromOverrideXML)
>>     end
>> I tried:
>>     local relationTable = xml.collected(viewFromXML,"/connection")
>>     for i=#relationTable, 1, -1 do
>>       connectionFromXML = relationTable[i]
>>       parseXMLConnection( rootFromXML, connectionFromXML, viewFromXML, rootFromOverrideXML)
>>     end
>> But apparently my lua knowledge is lacking (severely, I might say) as this ends with “attempt to get length of a function value“
> 
> it's an iterator
> 
>> What is the correct way to do it?
> xml.all

Tried to find documentation, but failed.

Tried this:

    local relationTable = xml.all(viewFromXML,"/connection")
    for i=#relationTable, 1, -1 do
      connectionFromXML = relationTable[i]
      parseXMLConnection( rootFromXML, connectionFromXML, viewFromXML, rootFromOverrideXML)
    end

but it fails as well.

G

> 
> -----------------------------------------------------------------
>                                          Hans Hagen | PRAGMA ADE
>              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>       tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -----------------------------------------------------------------

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20200501/e55cd73b/attachment.htm>


More information about the ntg-context mailing list