소스 검색

Lua : add missing boot method for setting __methods for oop

Earlier I added some logic to support oop in Lua.  It requires a change
to Boot.hx, since this class has some of the methods needed to maintain
the __methods list.
Justin Donaldson 10 년 전
부모
커밋
cba9a63644
1개의 변경된 파일3개의 추가작업 그리고 3개의 파일을 삭제
  1. 3 3
      std/lua/Boot.hx

+ 3 - 3
std/lua/Boot.hx

@@ -64,7 +64,8 @@ class Boot {
 
 
 	@:keep
 	@:keep
 	public static function defArray(tabobj: Dynamic, length : Int) : Array<Dynamic> {
 	public static function defArray(tabobj: Dynamic, length : Int) : Array<Dynamic> {
-		untyped __lua__("setmetatable(tabobj, Array.mt)");
+		untyped __lua__("tabobj.__methods = {Array.mt};
+			setmetatable(tabobj, {__index = lua.Boot.resolveMethod})");
 		tabobj.length = length;
 		tabobj.length = length;
 		return tabobj;
 		return tabobj;
 	}
 	}
@@ -89,8 +90,7 @@ class Boot {
 				case "function": return "<function>";
 				case "function": return "<function>";
 				case "thread": return "<thread>";
 				case "thread": return "<thread>";
 				case "table": { __lua__("local result = '';
 				case "table": { __lua__("local result = '';
-
-		if o.toString ~= nil then result = o.toString()
+		if o.toString ~= nil then result = o:toString()
 		elseif o.__tostring ~= nil then result = tostring(o)
 		elseif o.__tostring ~= nil then result = tostring(o)
 		elseif next(o) == nil then return '{}'
 		elseif next(o) == nil then return '{}'
 		else
 		else