瀏覽代碼

[lua] use cast for string length in order to pick up correct vanilla/default behavior

Justin Donaldson 6 年之前
父節點
當前提交
dce829cf69
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      std/lua/_std/Reflect.hx

+ 2 - 1
std/lua/_std/Reflect.hx

@@ -22,6 +22,7 @@
 import lua.Lua;
 import lua.TableTools;
 import lua.Boot;
+
 @:coreApi class Reflect {
 
 	public inline static function hasField( o : Dynamic, field : String ) : Bool {
@@ -33,7 +34,7 @@ import lua.Boot;
 	public static function field( o : Dynamic, field : String ) : Dynamic untyped {
 		if (Lua.type(o) == "string"){
 			if (field == "length"){
-				return lua.lib.luautf8.Utf8.len(o);
+				return cast (o : String).length;
 			} else return untyped String.prototype[field];
 		} else {
 		   	return try o[field] catch( e : Dynamic ) null;