Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
25 lines (18 sloc) 323 Bytes
h = {a=1}
z = {a=2}
meta_add = {}
function meta_add.__add(f1,f2)
return f1.a + f2.a
end
setmetatable(h,meta_add)
setmetatable(z,meta_add)
s = h + z
print(s) -- 3
meta_concat = {}
function meta_concat.__concat(f1,f2)
return f1.a + f2.a
end
setmetatable(h,meta_concat)
setmetatable(z,meta_concat)
s = h .. z
print(s)