lua-users home
lua-l archive

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


Roberto Ierusalimschy <roberto@inf.puc-rio.br> writes:
> That change also would improve a little the manipulation of large
> strings inside Lua, and even opens the door for the implementation of
> "external strings" (large strings where the buffer is outside Lua, for
> instance in ROM).

I would _love_ to have non-interned long Lua strings where the string
contents lived in a separate buffer (accessed via a pointer in the Lua
value I guess), so I could just mmap a file and create a Lua "string
pointer" from it (very quickly) -- rather than doing what I currently
do, which is mmap the file and copy the entire contents with
lua_pushlstring.... (a lot faster than Lua read("*a"), but still not as
fast as it could be)

If such a "external contents string" type were added to Lua, it would be
helpful to have an explicit "gc" callback as part of the Lua object,
which would get called when the Lua object was freed, and could free the
separate string buffer.

-Miles

-- 
"Suppose we've chosen the wrong god. Every time we go to church we're
just making him madder and madder." -- Homer Simpson