Well if you're making an equipment system there's quite a few ways you can store the information:
PHP Code:
enum SLOT
{
HEAD,
CHEST,
WEAPON,
FEET
}
function onCreated() {
this.equipment = {
"Helmet of Awesome",
"Golden Armorplate",
"Best. Sword. Ever.",
"Bunny Slippers"
};
echo(getHeadItem());
setHeadItem("Helmet of Change");
echo(getHeadItem());
}
function setHeadItem(item) {
this.equipment[SLOT.HEAD] = item;
}
function getHeadItem() {
return this.equipment[SLOT.HEAD];
}
function getChestItem() {
return this.equipment[SLOT.CHEST];
}
function getWeaponItem() {
return this.equipment[SLOT.WEAPON];
}
function getFeetItem() {
return this.equipment[SLOT.FEET];
}
enum is explained
here.
or simply:
PHP Code:
function onCreated() {
this.equipment.head = "Helmet of Laziness";
// etc.
echo(getHeadItem());
}
function getHeadItem() {
return this.equipment.head;
}
Item systems that uses IDs instead of strings for their items would store the IDs in each slot instead.
Of course the examples above will have to be modified to meet your needs, and proper flags.