瀏覽代碼

Lua : Moving the "pack" function into Boot proper.

I can define that boot function as a static function field.  It'll work
just the same, and I can avoid cluttering up genlua.ml.
Justin Donaldson 10 年之前
父節點
當前提交
792deb5a1d
共有 2 個文件被更改,包括 1 次插入3 次删除
  1. 0 3
      genlua.ml
  2. 1 0
      std/lua/Boot.hx

+ 0 - 3
genlua.ml

@@ -1306,9 +1306,6 @@ let generate com =
 	List.iter (generate_type_forward ctx) com.types;
 	newline ctx;
 
-	(* add the unpack function. *)
-	spr ctx "lua.Boot.unpack = function(...) return arg end"; newline ctx;
-
 	List.iter (generate_type ctx) com.types;
 	let rec chk_features e =
 		if is_dynamic_iterator ctx e then add_feature ctx "use.$iterator";

+ 1 - 0
std/lua/Boot.hx

@@ -22,6 +22,7 @@
 package lua;
 
 class Boot {
+	public static var unpack : Dynamic->lua.Table<Int,Dynamic> = untyped __lua__("function(...) return {...} end");
 
 	private static function __unhtml(s : String) {
 		return s.split("&").join("&amp;").split("<").join("&lt;").split(">").join("&gt;");