소스 검색

Polyfills for LuaJIT of table.pack and table.unpack

peyty 9 년 전
부모
커밋
5263484c4a
1개의 변경된 파일2개의 추가작업 그리고 0개의 파일을 삭제
  1. 2 0
      genlua.ml

+ 2 - 0
genlua.ml

@@ -1680,6 +1680,8 @@ let generate com =
 
 	spr ctx "pcall(require, 'bit32') pcall(require, 'bit') local _hx_bit = bit or bit32"; newline ctx;
 	spr ctx "local _hx_print = print or (function()end)"; newline ctx;
+	spr ctx "table.pack=table.pack or pack or function(...)return{n=select('#',...),...}end"; newline ctx;
+	spr ctx "table.unpack=table.unpack or unpack or function(t, i)i = i or 1 if t[i] ~= nil then return t[i],table.unpack(t, i + 1)end end"; newline ctx;
 
 	spr ctx "local _hx_anon = function(...)"; newline ctx;
 	spr ctx "   local ret = {__fields__ = {}};"; newline ctx;