Advertisement
cornedor

Untitled

Mar 7th, 2013
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Haxe 0.63 KB | None | 0 0
  1. package nl.mostwantit.two;
  2.  
  3. class GlobalConfig
  4. {
  5.     private static var keys:Array<String>;
  6.     private static var vars:Array<Dynamic>;
  7.    
  8.     public static function set(key:String, value:Dynamic):Void
  9.     {
  10.         if(vars == null)
  11.         {
  12.             vars = new Array<Dynamic>();
  13.             keys = new Array<String>();
  14.         }
  15.         if(Lambda.indexOf(keys, key) == -1)
  16.         {
  17.             vars.push(value);
  18.             keys.push(key);
  19.         }
  20.         else
  21.         {
  22.             vars[Lambda.indexOf(keys, key)] = value;
  23.         }
  24.     }
  25.     public static function get(key:String):Dynamic
  26.     {
  27.         if(vars == null) return null;
  28.         if(Lambda.indexOf(keys, key) == -1) return null;
  29.         return vars[Lambda.indexOf(keys, key)];
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement