ID:163474
 
I wasn't sure which forum this needs to be in so if it needs to be moved then move away!

Anyways, I don't exactly need to know how to do something, more so I just have a question about DM.

Basically, here's the deal. In this project I'm working on I completely clear a list using

listVar = list()


Now, previously this list consisted of objs and is cleared every time the player is killed. My question is, if I have no variables linking to the objs that were cleared, do they still exist?

If so, would it be more efficient to loop through the list and del() everyone one individually? Is there a max number of objs allowed that could be reasonably reached and would therefore need to del() them all or end up with a crashed game?

Thanks

Rifthaven wrote:
My question is, if I have no variables linking to the objs that were cleared, do they still exist?

Yeah, they'll still exist somewhere.

If so, would it be more efficient to loop through the list and del() everyone one individually?

You'll probably be better off del'ing them, in this case. Normally, though, I wouldn't recommend it, as 'del' forces DS to hunt down all of the references and nullify them, but /obj and /mob are special cases.

Is there a max number of objs allowed that could be reasonably reached and would therefore need to del() them all or end up with a crashed game?

65535, but the chances of you reaching that are a bit unlikely.
In response to Audeuro
I assume a for(var/obj/O in world) would still find these then?

Since the project I'm working on works in sets of rounds where all the objects would be stripped away anyways. I could just do an entire search at the end of a round and del() then, that way I don't have to loop through during actual gameplay and there would be virtually little chance of reaching that max if I delete all objects at the end of each round.
In response to Rifthaven
Assuming you want all /obj in the world to be deleted, and you know that's what you want, then yeah, that'd be fine.
In response to Audeuro
If I didn't I'd check with istype().


Thanks