[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: How about removing the underscores from metatables?
- From: steve donovan <steve.j.donovan@...>
- Date: Thu, 27 Jan 2011 12:20:15 +0200
On Thu, Jan 27, 2011 at 12:13 PM, Axel Kittenberger <axkibe@gmail.com> wrote:
> any content of metatables? My guess that newbies are so freightened
> from metas is just exactly the __syntax.
Hm, I don't think newbies should worry themselves about metatables.
They are a subtle concept and the underscores are the least part.
Bear in mind that it _is_ common to put things into metatables;
there's a common OOP pattern that works like this:
-- define a class
A = {}
A.__index = A
function A:method() ... end
-- make an instance of the class
a = setmetatable({},A)
'index' will easily collide with a possible method name.
steve d.