Browse Source

Lua: check for null in Reflect.callMethod for object, we need different behavior in that case

Justin Donaldson 9 years ago
parent
commit
659dfedffa
1 changed files with 5 additions and 1 deletions
  1. 5 1
      std/lua/_std/Reflect.hx

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

@@ -59,7 +59,11 @@ import lua.Boot;
 		} else {
 		} else {
 			var new_args:lua.Table<Int,String> = untyped __lua_table__(o);
 			var new_args:lua.Table<Int,String> = untyped __lua_table__(o);
 			// Lua's table concat will skip the first element since it starts from 1
 			// Lua's table concat will skip the first element since it starts from 1
-			new_args[2] = args[0];
+			if (o != null){
+				new_args[2] = args[0];
+			} else {
+				new_args[1] = args[0];
+			}
 			new_args = lua.PairTools.ipairsConcat(new_args, cast args);
 			new_args = lua.PairTools.ipairsConcat(new_args, cast args);
 			return func(lua.Table.unpack(new_args));
 			return func(lua.Table.unpack(new_args));
 		}
 		}