valenok/mongoose — pull request #123 by abadc0de (2013-03-06 23:06:23+00:00)
Title: Add output buffering for Lua pages

An empty table named `mg.buffers` is provided. Whenever `mg.buffers` is not empty and the last item is a string, bytes that would be sent to `mg_write` are instead concatenated to the last item in `mg.buffers`.

The "buffer_push" and "buffer_pop" functions are up to the user to implement in Lua, like this:

function buffer_push()
table.insert(mg.buffers, "")
end

function buffer_pop()
return table.remove(mg.buffers)
end

See groups.google.com/forum/#!topic/mongoose-users/RCgAQFxYAmM