lua-users home
lua-l archive

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


I remember what Diego needed at that time.
Could this idea be extended to have const Lua strings which map
to a const char* ?
I have buffer management code usually on the C side and it would be nice
to get a (const ) Lua string without interning another string. That is,
the string is const as far as the Lua side is concerned.
Similarly on the Lua side, a substring that returns an external
const Lua string would solve most hassles I have encountered
with Lua strings. I guess this is an extra data type and could be
a bit confusing.

db


On 7/13/07, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
> And ... IMHO mutable strings probably won't have less management
> overhead than buffers implemented with userdatas. Yes, I know,
> passing userdatas to C APIs expecting plain strings doesn't work
> right now. But this can be changed.

This seems a more promissing approach. Diego suggested something in
these lines some time ago. (Of course, the userdata must be converted to
a char*, not to a Lua string; this is tricky with metamethods...)

-- Roberto