I'm trying to parse some xml files with lua and I'm stuck on this function:
function get_node_by_id (xml, nodeId)
for i=1, #xml, 1 do
if get_attr_by_name(xml[i], 'Id') == nodeId then
print ("TRUEEEEE", i, xml[i])
return xml[i]
else
get_node_by_id(xml[i], nodeId)
end
end
end
The problem is that print("TRUEEEEE", i, xml[i]) works, but it returns nil in the next line return xml[i].
What am I doing wrong?