lua-users home
lua-l archive

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


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