Browse Source

Update Std.hx

Justinfront 12 years ago
parent
commit
00f6df4490
1 changed files with 4 additions and 0 deletions
  1. 4 0
      std/cs/_std/Std.hx

+ 4 - 0
std/cs/_std/Std.hx

@@ -234,6 +234,10 @@ import cs.internal.Exceptions;
 		}
 	}
 
+	public static function instance<T>( v : { }, c : Class<T> ) : T {
+		return Std.is(v, c) ? cast v : null;
+	}
+
 	public static function random( x : Int ) : Int {
 		if (x <= 0) return 0;
 		return untyped Math.rand.Next(x);