Cluain / Lua-Simple-XML-Parser

Read simple XML easily
153 stars 91 forks source link

Incorrect handling of tags with same name as methods of node class #18

Open bFooz opened 4 years ago

bFooz commented 4 years ago

I am using Lua 5.3 in a daw Reaper.

This xml will not be parsed:

<name>text</name>

I see the problem might be here

function node:addChild(child)
   if self[child:name()] ~= nil then
       if type(self[child:name()].name) == "function" then            
            local tempTable = {}
            table.insert(tempTable, self[child:name()])
            self[child:name()] = tempTable
       end
       table.insert(self[child:name()], child)
   else           
       self[child:name()] = child
   end
   table.insert(self.___children, child)

end