game_del()
A small proc I've made that I find very helpful in my games, I thought I would share it.
This deletion method wont return your code like the built-in del does.
This deletion method wont return your code like the built-in del does.
proc game_del(atom/a) var/list/built_in = list("type","parent_type","gender","verbs","vars","group") for(var/v in a.vars) if(!(v in built_in)) a.vars[v] = null |
Posted by Smokey Joe on Thursday, October 23, 2008 09:21AM
- 4 comments
(link)
/


Login to post a comment.
#4 Jeff8500:
Smokey Joe wrote:
> Jeff8500 wrote:
> > Or, instead of setting it to null, you could set it to its initial value with the initial() proc :P
>
> I want to delete it, when all its variables are null like this, it sets its loc to zero, and deletes any references to the object leaving it to the garbage collector.
Oh, I thought you were going for more of a game reset type thing :P
If you're wondering, garbage collection isn't my strong point...
Thursday, October 23, 2008 02:21PM
#3 Smokey Joe:
Jeff8500 wrote:
> Or, instead of setting it to null, you could set it to its initial value with the initial() proc :P
I want to delete it, when all its variables are null like this, it sets its loc to zero, and deletes any references to the object leaving it to the garbage collector.
Thursday, October 23, 2008 02:18PM
#2 Jeff8500:
Or, instead of setting it to null, you could set it to its initial value with the initial() proc :P
Thursday, October 23, 2008 01:49PM
#1 Duelmaster409:
Well, you could do it manually, but that system works in fine. Could be used for starting new games or something, but either way I'd say that's an efficient way of exterminating all non-built in variables.
Thursday, October 23, 2008 11:32AM