[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Naming userdata objects
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Wed, 19 Nov 2003 09:30:59 -0200
>While fiddling with the commandline tool last night trying out various
>io operations, I noticed that if one prints out the value of a result of
>io.open, you get told it's a 'file' object.
>I was wondering how this is done, since currently all my userdata
>objects come out as 'userdata' which is a bit irritating.
Using a __tostring metamethod: tostring looks into metatables of userdata
and use the field __tostring if present.