lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 07/05/14 14:40, Thiago L. wrote:
> So I have a challenge for you all: A table copy script in less than 270
> chars
...
> Finally, here is the 270 chars long script made: [1]
> local k,o,n,s,d=pairs,type,"table"s,d=function(a,b)b={}for x,y in k(a)do
> b[x]=y end return b end,function(a,r,t)t={}r=r or{}r[a]=t for x,y in
> k(a)do if n==o(x)then x=r[x]or d(x,r)end if n==o(y)then y=r[y]or
> d(y,r)end t[x]=y end return t end table.copy={shallow=s,deep=d}
> 
> [1] - This one might be a bit easier to read/understand:
> https://gist.github.com/SoniEx2/fc5d3614614e4e3fe131

Would it not be better to compare luac output than source size?

Also, run times?

Scott