This is something that
should be done with a verb, not a property. It's a dynamic number, and
setting it manually like that is a really bad practice.
Make a verb
ROOT:weight with the following code: [Where ROOT is the
same place .weight is defined]
weight = this.weight;
for thing in (this.contents)
weight = weight +
thing:weight();
endfor
return weight;
This way,
.weight is always
the weight of the empty object. You should never refer to it in code,
unless you need to know how much it would be if empty.
- Katelyn
Thursday, 3 April
2014 3:31 PM