[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: __index and function args
- From: "Wesley Smith" <wesley.hoke@...>
- Date: Thu, 28 Sep 2006 15:35:32 -0700
Let's say I have
Obj = {}
Obj_mt = { __index = function(t, k) -- do something
end
}
function Obj.new(o)
setmetatable(o, Obj_mt)
return o
end
obj1 = Obj.new{}
obj1:draw_circle(0, 0, 0.5)
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?
thanks,
wes