Building output text is the write-side mirror of reading input text.

Buffer Append

buffer_append.lua
local word = 
local buffer = "start"

buffer = buffer .. ":" .. word
buffer = buffer .. ":done"

print("word=" .. word)
print("buffer=" .. buffer)
local word = 
local buffer = "start"

buffer = buffer .. ":" .. word
buffer = buffer .. ":done"

print("word=" .. word)
print("buffer=" .. buffer)
local word = 
local buffer = "start"

buffer = buffer .. ":" .. word
buffer = buffer .. ":done"

print("word=" .. word)
print("buffer=" .. buffer)
output buffer A small string buffer makes write-style examples deterministic for static replay.