I don't understand how you can compare two strings in constant time by doing a pointer comparison. Can you elaborate?
edit: someone answered this in a sibling post with 'yes'.
This means strings can never be modified => a new one is created.
The down side is that string modification (including appending) in a loop is expensive.
local string_buffer = {}
while condition() do
table.insert(string_buffer, getString())
end
local string = table.concat(string_buffer)