In response to Zilal (#19)
On 11/2/00 9:27 am Zilal wrote:

Now... here's something I don't know... if I do the following:

var/obj/O = new /obj()
O.loc = usr.list_of_things
usr.list_of_things.len = 0

First, does O really get put in the list, or just a reference to O? Second, does O get deleted when the list length is set to 0?

The "loc" property refers to an actual object location, so you can only set it to another object (or null). Saying something is located "in a list" is too ambiguous, because it could be located in more than one list. The only exception for this is the contents lists for objects:

usr.contents += O // will also reassign O.loc

As for your second question, objects never get deleted when they are removed from lists. This is because they may be referenced elsewhere in the world. In general, the "garbage collector" will automatically delete references when they are no longer usable (that is, accessible from somewhere in your code), but in the case of objects this is never true because they are always in world.contents (accessible via locate()), unless you explicitely delete them.
Page: 1 2