I strongly suggest starting using JSON instead of arrays. It will take a little time to learn, but will save you a lot of time and headache down the road!
Consider this JSON, which stores all weapons in the game and their stats:
{
"IronSword": {
"Type": "Melee",
"Rarity": "Common",
"Damage": 25,
"Attack Speed": 1.2,
"Crit Chance": "5%",
"Range": 1.5,
"Durability": 100,
"Special Effect": "None"
},
"SteelAxe": {
"Type": "Melee",
"Rarity": "Uncommon",
"Damage": 40,
"Attack Speed": 0.9,
"Crit Chance": "3%",
"Range": 1.3,
"Durability": 120,
"Special Effect": "Cleave"
},
"HunterBow": {
"Type": "Ranged",
"Rarity": "Common",
"Damage": 18,
"Attack Speed": 1.5,
"Crit Chance": "10%",
"Range": 8.0,
"Durability": 80,
"Special Effect": "Quick Draw"
},
"Longbow": {
"Type": "Ranged",
"Rarity": "Rare",
"Damage": 35,
"Attack Speed": 1.1,
"Crit Chance": "15%",
"Range": 10.0,
"Durability": 70,
"Special Effect": "Armor Pierce"
}
}
You can access any stat directly with a single expression, for example: WeaponJSON.Get("Longbow.Damage"). It's a lot easier than dealing with arrays!
.
Besides, JSON is flexible - you can create records and structures that are simply not possible with arrays:
.
And here is a more advanced trick - I often store the data as an array in a table format, which makes it easy to view and modify in the editor. But at runtime, I convert it to JSON. I've been using this method for the past few years with great success.