[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Representing XML in tables
- From: "Peter Loveday" <peter@...>
- Date: Fri, 4 Jul 2003 13:13:35 -0400
Whatever is used, it would be nice if it were able to be dumped to a text
file in a Lua table constructor form. I don't think {} or metatable index
would work here (also, while I can't think of a use for real metatables on
an xml tag right now, I'm sure there'd be some application where we'd regret
that choice if we hijacked that entry).
I would be in favour of either [0] or "". Or perhaps "." - that's illegal
as the first character in XML names, and kind of implies 'this level' in
directory semantics anyway. Or '/' if root seems more appropriate.
Hell anything unique would do, just keep it as a string or number or
boolean, so it can be repesented as text.
Love, Light and Peace,
- Peter Loveday
Director of Development, eyeon Software
----- Original Message -----
From: "Wim Couwenberg" <w.couwenberg@chello.nl>
To: "Lua list" <lua@bazar2.conectiva.com.br>
Sent: Friday, July 04, 2003 1:08 PM
Subject: Re: Representing XML in tables
> > These will certainly work but we would ideally want a value that can
> > be quoted as a literal;
>
> Why? You can always write xmlRoot[xml.name], if xml.name is assigned the
> name index you want to use and it's not any different from xmlRoot[true]
> that you proposed.
>
> > the literal should be a nice, short token if
> > possible. The "{}" is certainly short, but do all empty tables have
> > the same hash value? (Possibly, but it is not obvious).
>
> Nope. Try
>
> print({} == {})
>
> Boolean true or false can be used. You could also use the empty string ""
> (which is also not a valid XML name.)
>
> --
> Wim
>
>
>