This means the order of children is preserved.
It also means the name of each node isn't duplicated. This was
an opportunity for an inconsistent XNode tree. Nodes can now be
renamed after being inserted into a tree.
Searching for children by name isn't efficient. Use attributes for that.
the text value.
This means that FOREACH_Attr will iterate over the text value.
Compare with TEXT_ATTRIBUTE_NAME if you explicitly don't want
that.
This is simpler; an XNode branches out in two places--attributes
and children--instead of three.
It also means that nodes without any text data actually don't
have any text data--the attribute simply doesn't exist. The
*TextValue functions are also no longer needed, though some
are left in now for compatibility (and maybe convenience).
Each actor type needs to evaluate attributes; only a few do. Strings
are handled with the "@foo()" notation.
Instead, after loading an XML file for loading as an actor,
precompile all XML attributes as Lua expressions.
The primary difference to code is:
- previously, Attr="string" would act as a string if it was being
read as one. Now, specify Attr='"string"'. Attr="@string" is
a shorthand. (note that @strings will not be parsed as Lua
strings, so can not use Lua escape characters)
- previously, Attr="@func()" would evaluate func(), and the value
of the attribute would be the return value of the function. This
was only supported for a few attributes. Now, say Attr="func()",
and this will work for all fields.
- Attributes of other types are unchanged, except that all attributes
may be Lua expressions, eg. Width="SCREEN_WIDTH".
- Attributes names ending with "Command" are special, like metrics.
Prefix "%" to disable this.
This brings XML handling in line with metric handling. (This is an intermediary
step; I have another idea that follows from this that should eliminate the annoying
"'foo'"/"@foo".)