lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> There are other ways. You can index a table by any value, so we could
> have a convention where the nil value, say, could be used as the
> index for the XML tag:-

nil cannot be used as index in Lua.  You could use tag = 0 (a number), tag =
{}, or even tag = function() end.

> write
> "xmlRoot.name" instead of "xmlRoot.attr.name" each time.

Scott's proposal uses xmlRoot.name as the name of the element.  Only
attributes are stored in xmlRoot.attributes.

> This would mean that most Lua tables could be exported to XML
> reasonably even if the author didn't originally design them to be
> used like this

This is not so easy as it sounds.  See numerous postings about serialization
on this list.

--
Wim