lua-users home
lua-l archive

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


>To support object:method() syntax, LHF adds a "metatable" key to the
>"gdbm" table in "C" and then in "gdbm.lua" he has a statement like
>this:
>  gdbm.metatable.__index=gdbm
>which is what is allowing the object:method() syntax to work;

I added the "metatable" field in the "gdbm" table to be get access in Lua
to the metatable of GDBM objects in Lua. It was purely for convenience, because
some things are easier to write in Lua, specially during the test phase.

The code
	gdbm.metatable.__index=gdbm
could have just as easily been written in C, as done in
	http://lua-users.org/wiki/UserDataWithPointerExample
--lhf