lua-users home
lua-l archive

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


On Mon, May 25, 2009 at 7:18 PM, Petite Abeille <petite_abeille@mac.com> wrote:
> Perhaps I'm totally missing the point, but... what's the difference between
> a function with a metatable and a table with a call metamethod?

Well, indeed they are both callable. But then one has to be careful to
be consistent, and everything ends up being functors.  I'll do a few
microbenchmarks to see what the cost implications of functors versus
functions would be, since measurement is better than opinion.

A short answer to your rhetorical question would be: the first is
primarily meant to be called, and the second is primarily intended for
indexing.

steve d.