A simple, pure Lua implementation of String buffers using tables.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
license.md
readme.md
strbuffer-dev-1.rockspec

readme.md

Lua String Buffers

Usage

strbuffer = require 'strbuffer'
local buf = strbuffer()

buf:append('the', 'answer', 'is', 42) -- Multiple arguments allowed, everything gets `tostring`ed

buf:concat('-')
--> 'the-answer-is-42'

tostring(buf)
--> 'theansweris42'
-- syntactic sugar for buf:concat()

-- Line buffer (concatenated with newline by default)
local document = strbuffer('\n'):append("Heading")

print(document + "line 1" + "line 2")
--> Heading
--> line 1
--> line 2