by Spike » Fri Nov 18, 2011 3:03 pm
1:
I don't know what's special about dremove, so I can't answer that one fully.
self refers to the entity spawned in Func_1, but either it has been removed, or its think function has been set to cause it to be removed. Either way, you can still assign to its fields... but you really shouldn't do so.
2:
the dremove call removes (I assume, I've not seen the dremove function itself) an entity which was probably spawned inside Func_1. If Func_1 was called multiple times then it'll remove just one of those entities (per time Func_2 is called). If Func_2 is called more than Func_1 was called, the whole thing will break.
I'm careful to not say that "it removes 'foo'" because, technically, it doesn't. Once Func_1 returns, foo leaves scope, and nothing is known as that particuar 'foo' any more.
So no, it doesn't 'remove foo' because 'foo' no longer exists anyway, but the entity that foo refered to does still exist, and its that entity which is removed, rather than simply 'foo'.
Many times you'll see someone refer to it as though Func_2 does remove Func_1, quite simply they're being lazy, and are technically incorrect. However that distinction is not a major one, and is usually not actually relevent as any experienced programmer will know what was actually meant even if what is said is a lie, so its quite common to say it, or even think that way. Just remember that its not actually true when you do have multiple instances of 'foo' entities at the same.
.