Dictionary of Dictionaries Tutorial Script

#pragma strict

import System.Collections.Generic;

var item : GameObject;

var stats = Dictionary.<String,Dictionary.<String,String> >();

stats["Helm of the Bear"] = Dictionary.<String,String>();
stats["Helm of the Bear"]["Type"] = "Head Armor";
stats["Helm of the Bear"]["Defence"] = "55";
stats["Helm of the Bear"]["Block"] = "25";
stats["Helm of the Bear"]["Stamina"] = "10";

stats["Helm of the Wolf"] = Dictionary.<String,String>();
stats["Helm of the Wolf"]["Type"] = "Head Armor";
stats["Helm of the Wolf"]["Defence"] = "45";
stats["Helm of the Wolf"]["Block"] = "15";
stats["Helm of the Wolf"]["Stamina"] = "1";

stats["Helm of the Eagle"] = Dictionary.<String,String>();
stats["Helm of the Eagle"]["Type"] = "Head Armor";
stats["Helm of the Eagle"]["Defence"] = "65";
stats["Helm of the Eagle"]["Block"] = "35";
stats["Helm of the Eagle"]["Stamina"] = "20";

function Start(){

Debug.Log("Defence: " + stats[item.name]["Defence"]);
}