lua-users home
lua-l archive

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

On Sat, Feb 13, 2010 at 2:15 PM, spir <> wrote:
> Lua files don't seem to have any metatable, so I created one:

No, they do!

> It seems the metatable in a way "hides" builtin methods. ?

Lua files are userdata objects, and as such the only way they can
*have* methods is if they have a metatable that includes an __index
table or function. That is the only mechanism that allows for it. If
you get the metatable of a file you will see that it includes an
__index table, and this is what contains all the method functions
(read, write, close, etc.).