mob/var/Equipment[1][5]
or
mob/var/Equipment[5]
Problem description:
Which would be better to use for an Equipment System? 1 list, with 5 elements or 5 lists?
ID:1235458
Apr 13 2013, 7:57 am
|
|
Code:
mob/var/Equipment[1][5] Problem description: Which would be better to use for an Equipment System? 1 list, with 5 elements or 5 lists? |
In response to Albro1
|
|
I was doing (example below) to assign objects to the index number.
Equipment[1][1]=new/obj/hair Then for adding overlays... (I didn't test this yet, I'm assuming it'll work.) mob/verb/Add() Would this be a good way to do it? Or is there a better way I could do it? |
If you aren't going to ever use Equipment[2][i], then there's no point in having that list association.
Just do Equipment[5], and then you can simply do Equipment[i]. |
mob/var/Equipment[5]
This creates a list with a len of 5 - it has 5 elements, all set to null. If you do Equipment[0], then it initializes a new list with an undefined len, which is just the same as doing Equipment = list().
mob/var/Equipment[1][5]
I haven't used things like this very much, but it is to my understanding that this initializes a list with a len of 1 that is associated with a list with a len of 5 - much like doing this: