2
0
Эх сурвалжийг харах

Lua: make the special defArray method a little more flexible

Justin Donaldson 10 жил өмнө
parent
commit
98dd61a469
1 өөрчлөгдсөн 2 нэмэгдсэн , 2 устгасан
  1. 2 2
      std/lua/Boot.hx

+ 2 - 2
std/lua/Boot.hx

@@ -96,8 +96,8 @@ class Boot {
 	}
 
 	@:keep
-	public static function defArray(tabobj: Dynamic, length : Int) : Array<Dynamic>  untyped {
-		tabobj.length = length;
+	public static function defArray(tabobj: Dynamic, ?length : Int) : Array<Dynamic>  untyped {
+		tabobj.length = length != null ? length : lua.TableTools.getn(tabobj);
 		setmetatable(tabobj, {
 			__index : __lua__("Array.prototype"),
 			__newindex : lua.Boot.arrayNewIndex