lua-users home
lua-l archive

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


> When draw_circle is called, it looks up __index and falls the function
> defined in the metatable above where t = obj1 and k = "draw_circle".
> 
> My question is, how do I get at the arguments?  What happens to 0, 0,
> 0.5 and how can I access them?

As you have discovered, the __index metamethod is not about method call,
it's about table indexing. As the manual says, obj1:draw_circle(0, 0, 0.5)
is sugar for obj1.draw_circle(obj1,0, 0, 0.5). The __index metamethod is
the about the obj1.draw_circle part, not about the call part.
--lhf