lua-users home
lua-l archive

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


David Kastrup wrote:

> One can't use Lua's string operations (in particular pattern matching)
> on userdata, and there is no actual necessity to intern them for most
> applications (excepting indexing or fast equality tests).
> 

One also can't rely on Lua's string operations to work on strings unless
they are interned in certain situations. Accordingly, it follows that
the userdata would expose a method through its __index metamethod that
would allow you to intern a string and produce a true Lua string. This
would require more work on the Lua side, but zero work on the VM side.
It would also allow you to explicitly control how an uninterned string
becomes interned, so you know precisely where your vulnerabilities lie.

======

Matthew P. Del Buono