Getting and using a float value from a Hashtable

How can I use a float value stored in a Hashtable? The following javascript code gives the error "Operator '+' cannot be used with a left hand side of type 'Object' and a right hand side of type 'float'."

    var attributes: Hashtable = new Hashtable();
    attributes.Add("nave_width", 20.0);
    var tmp: float = attributes["nave_width"] + 1.5;

I am trying to use my own form of key-value coding in my objects so I would like all the attributes for my object to be stored in a Hashtable.

You could mess about #pragma downcast at the top of your script, but the best way would be to use a Dictionary instead of a Hashtable - they're similar, but Dictionary has a predefined type:

var attributes = new Dictionary.<String, float>();
attributes["nave_width"] = 20;
var tmp = attributes["nave_width"] + 1.5;

You'll need import System.Collections.Generic; at the top of your script for it