Skip to content

A simple, pure Lua implementation of String buffers using tables.

License

Notifications You must be signed in to change notification settings

DarkWiiPlayer/lua_strbuffer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A simple, pure Lua implementation of String buffers using tables.

Resources

License

Stars

Watchers

Forks

Packages

No packages published