lua-users home
lua-l archive

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



On May 3, 2015, at 7:03 AM, Sam Putman <atmanistan@gmail.com> wrote:



On Sun, May 3, 2015 at 6:53 AM, Nagaev Boris <bnagaev@gmail.com> wrote:

Lua uses one metatable for all strings.


Indeed. My desire is to be able to extend particular strings by putting a metatable
between the pointer to the interned string and the global string metatable.



If you want to subclass strings, wrap them in a table with an appropriate metatable that forwards to the string metatable. This isn’t really sublcassing strings of course, it’s creating an object that happens to have a string as it’s data and inherits string functionality, which is really what i think you are asking for.

—Tim