[DGD] object finding
Par Winzell
zell at skotos.net
Wed Apr 26 22:20:01 CEST 2006
Noah Gibbs wrote:
> You can't, in general, have a standard LPC list of all the indices. In most
> MUDs, you *will* have more active object indices than the maximum size of an
> LPC list. This is why the Kernel lib stores this stuff as a linked list,
> incidentally, and why you really don't want to iterate through all of it in one
> go (you may easily have more objects than RAM).
Eh, well, it's easy enough storing this data yourself; you just use a
mapping of mappings. But I agree with Shentino that for emergency repair
it'd be nice to have as big a toolbox for investigating the state dump
directly.
> There *are* some cute ways to use find_object() to do roughly this if you
> know that the object type you're playing with composes most of the MUD's data
> size (for instance, if you have a single object type and you're looking through
> all instances of it).
What Noah means is that if you have a very common master object;
/obj/thing, say, you can basically do:
for (i = 0; i < 100000; i ++) {
if (find_object("/base/obj#" + i)) { ... do something ... }
}
I've always kind of wished there were a find_object(i) actually...
Zell
More information about the DGD
mailing list