Quantcast
Channel: The Battle for Wesnoth Forums
Viewing all articles
Browse latest Browse all 2259

Lua Labs • Re: wml.get_child for unit

$
0
0
Yes. Different behaviour too if you wanted to do anything with the wml table.

Code:

$ unit.__cfg == unit.__cfgfalse
I don't really get your confusion or how you drew any of these conclusions. Every time you access unit.__cfg, the game serializes that unit to WML and returns the result. If you access __cfg twice in a row, you'll end up with two identical but independent WML tables. If you access __cfg, make some change to the unit directly, and access __cfg again, the first WML table reflects the state of the unit before the change and the second WML table reflects the state of the unit after the change.
Personally I think it would be better if it were something like .cfg() instead of .__cfg. Magical properties are always confusing.
The second version doesn't serialize anything.
It doesn't? (Did you see the .__cfg at the end of the first line?)

Statistics: Posted by gnombat — Today, 6:05 pm



Viewing all articles
Browse latest Browse all 2259

Trending Articles