lua-users home
lua-l archive

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

>>>>> "Luiz" == Luiz Henrique de Figueiredo <> writes:

 >> Or should I best present a "tostring metafunction" for each of my
 >> userdata, which is programmed similar to f_tostring in liolib.c,

 Luiz> If you use luaL_setmetatable,

FWIW, I never do this and never advise others to do so, because the fact
that luaL_setmetatable relies on string keys means it does not give any
guarantee of uniqueness and relies entirely on module authors to choose
non-conflicting names.

I always use my own equivalents for luaL_setmetatable and
luaL_checkudata that work off lightuserdata keys instead.