lua-users home
lua-l archive

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


> This is sort of the reason why I wish Lua's core had a library
> specifically for buffers, something where you can create userdata
> buffers and fill it with lua values rawly, and then convert it into a
> immutable, pooled Lua string if you wish.

The traditional method is this:

  local buffer = {}  -- create a buffer
  
  buffer[#buffer + 1] = x    -- add values
  
  s = table.concat(buffer)    -- convert it into a immutable Lua string

Yes, I know, it would be faster with specific support. Mostly everything
in Lua (or any other interpreter) would be faster with specific support.

-- Roberto