lua-users home
lua-l archive

Re: Thoughts wanted on automatically "wrapping" existing functions.

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


Try something like this
local I=setmetatable({},{
 __index= function (t,k)
 print("def",k)
 local f=function(...)
 print("call",k)
 local result=_img[k](_img,...)
 show()
 return result
 end
 rawset(t,k,f)
 return f
 end
})
I.setpixel(1,2,3,4)
I.setpixel(10,20,30,4)

AltStyle によって変換されたページ (->オリジナル) /