lua-users home
lua-l archive

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



On Aug 23, 2014, at 12:11 AM, Sean Conner <sean@conman.org> wrote:


I wish userdata could be used in the same
place a string is expected.  I would love an "invisible" memcmp() if
it's a userdata-string comparison (==) or to be able to directly use
the string.*() functions on them.


One of the basic goals of userdata is that it NOT be mutable (or even viewable) from Lua. The contract is that C code can let Lua act as custodian for some state which it knows Lua *cannot* access; it is opaque to Lua by design. Of course, C code can expose the data indirectly, but that is the business of the C code.

—Tim