public void createVar(string name, lolValue lv)
 {
     variableList.Add (name, lv.getCopy());
     MainClass.win.refreshSymbol(this);
 }
 public void setValue(lolValue lv)
 {
     type = lv.getType();
     value = lv.getValue();
 }
 bool isNumberType(lolValue lv)
 {
     return lv.getType() == LOLType.NUMBR || lv.getType() == LOLType.NUMBAR;
 }
 lolValue implicitCast(lolValue lv, LOLType toType)
 {
     if(lv.getType() == LOLType.NOOB && toType != LOLType.TROOF) {
         setError("Cannot implicitly cast NOOB to any type except TROOF");
         return null;
     }
     return cast(lv, toType);
 }
 lolValue cast(lolValue lv, LOLType toType)
 {
     string newValue = "";
     switch(toType) {	//the type to be casted to
         case LOLType.NOOB:
             break;
         case LOLType.NUMBAR:
             switch (lv.getType()) {		//getting the original type
                 case LOLType.NOOB:
                     newValue = "0";
                     break;
                 case LOLType.NUMBAR:
                     newValue = lv.getValue();
                     break;
                 case LOLType.NUMBR:
                     newValue = lv.getValue();
                     break;
                 case LOLType.TROOF:
                     newValue = lv.getValue() == "FAIL"? "0": "1";
                     break;
                 case LOLType.YARN:
                     decimal dec;
                     if(decimal.TryParse(lv.getValue().ToString(), out dec) == true)
                         newValue = decimal.Parse(lv.getValue()).ToString();
                     else setError("Unable to cast value");
                     break;
             }
             break;
         case LOLType.NUMBR:
             switch (lv.getType()) {		//getting the original type
                 case LOLType.NOOB:
                     newValue = "0";
                     break;
                 case LOLType.NUMBAR:
                     newValue = Math.Floor(decimal.Parse(lv.getValue())).ToString();
                     break;
                 case LOLType.NUMBR:
                     newValue = lv.getValue();
                     break;
                 case LOLType.TROOF:
                     newValue = lv.getValue() == "FAIL"? "0": "1";
                     break;
                 case LOLType.YARN:
                     decimal dec;
                     if (decimal.TryParse (lv.getValue ().ToString (), out dec) == true) {
                         newValue = Math.Floor(decimal.Parse (lv.getValue ())).ToString();
                     }
                     else setError("Unable to cast value");
                     break;
             }
             break;
         case LOLType.TROOF:
             switch (lv.getType()) {		//getting the original type
                 case LOLType.NOOB:
                     newValue = "FAIL";
                     break;
                 case LOLType.NUMBAR:
                     newValue = decimal.Parse(lv.getValue()) != 0? "WIN": "FAIL";
                     break;
                 case LOLType.NUMBR:
                     newValue = int.Parse(lv.getValue()) != 0? "WIN": "FAIL";
                     break;
                 case LOLType.TROOF:
                     newValue = lv.getValue();
                     break;
                 case LOLType.YARN:
                     newValue = lv.getValue().Length != 0? "WIN": "FAIL";
                     break;
             }
             break;
         case LOLType.YARN:
             newValue = lv.getValue();
             break;
     }
     return new lolValue(toType, newValue);
 }
 public new void setValue(lolValue lv)
 {
     base.setValue (lv);
     variableTable.setVar ("IT", lv.getType (), lv.getValue ());
 }