Browse Source

Lua: fix for defArray

Justin Donaldson 10 years ago
parent
commit
40e1cf08ce
1 changed files with 1 additions and 1 deletions
  1. 1 1
      std/lua/Boot.hx

+ 1 - 1
std/lua/Boot.hx

@@ -97,7 +97,7 @@ class Boot {
 
 
 	@:keep
 	@:keep
 	public static function defArray(tabobj: Dynamic) : Array<Dynamic>  untyped {
 	public static function defArray(tabobj: Dynamic) : Array<Dynamic>  untyped {
-		tabobj.length = lua.TableTools.maxn(tabobj) + 1;
+		tabobj.length = tabobj[0] == null ? 0 : lua.TableTools.maxn(tabobj) + 1;
 		setmetatable(tabobj, {
 		setmetatable(tabobj, {
 			__index : __lua__("Array.prototype"),
 			__index : __lua__("Array.prototype"),
 			__newindex : lua.Boot.arrayNewIndex
 			__newindex : lua.Boot.arrayNewIndex