[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Pooling of strings is good
- From: Tim Hill <drtimhill@...>
- Date: Sun, 24 Aug 2014 18:44:11 -0700
On Aug 23, 2014, at 12:47 AM, Coroutines <coroutines@gmail.com> wrote:
>
> I'm saying I want to be able to write 'cat' == io.stdout and have it
> do a memcmp() of their contents (the data section after the header).
>
So override __tostring() in your userdata metatable. And if it’s a userdata supplied by someone else then they probably don’t want you messing around inside it. There is good reason for this; userdata is MEANT to be opaque to Lua code.
—Tim