lua-users home
lua-l archive

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


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

If you use luaL_setmetatable, then this is automatically done for you:
luaL_setmetatable sets __name to the string it gets. Then tostring
calls luaL_tolstring which uses __name to convert userdata to
tostring.