seqlua
diff seqlua_c_example_test.lua @ 8:144f0bddee2b
Pass value as argument to __call metamethod
| author | jbe |
|---|---|
| date | Wed Aug 20 04:24:08 2014 +0200 (2014-08-20) |
| parents | 47f9b323d68c |
| children | 564320bb2862 |
line diff
1.1 --- a/seqlua_c_example_test.lua Wed Aug 20 01:59:55 2014 +0200 1.2 +++ b/seqlua_c_example_test.lua Wed Aug 20 04:24:08 2014 +0200 1.3 @@ -22,3 +22,15 @@ 1.4 -- prints: 1.5 -- a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z 1.6 1.7 +printthree(alphabet()) 1.8 +-- prints: 1.9 +-- a 1.10 +-- b 1.11 +-- c 1.12 + 1.13 +printthree(setmetatable({v="x"}, {__call=function(t) return t.v end})) 1.14 +-- prints: 1.15 +-- x 1.16 +-- x 1.17 +-- x 1.18 +