lua-users home
lua-l archive

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


What is this 'metatable' thing below? It is not something from standard LUA
distribution, is it?
AB

----- Original Message -----
From: "Tom Wrensch" <twrensch@uop.edu>
To: "Multiple recipients of list" <lua-l@tecgraf.puc-rio.br>
Sent: Wednesday, July 10, 2002 3:47 PM
Subject: Re: The call "tag" in 5.0-work0


On Thu, 11 Jul 2002, [iso-8859-1] Björn De Meyer wrote:

> Tom Wrensch wrote:
> >
> > Sorry, just answered by own dumb question. You need to put underscores
> > before the name in 5.0 work 0.
> >
>
> Hmm... is this to facilitate the use of tables as their own
> metatables? Or is that not allowed?

Well, I tried this:

  > t = {}
  > metatable(t,t)
  > t.__call = function(...) print(unpack(arg)) end
  > t(1,2,3)
  table: 003FDCB0 1       2       3

In Lua 5.0 work-0 and it worked just fine. So I'd have to say that it is
definitely allowed. Opens up some interesting possibilities, doesn't it?

  - Tom