Changed buffer to use lines, replaced maxbuffer -> maxlines

This commit is contained in:
rxi 2014-04-10 18:23:04 +01:00
parent a370307e8d
commit aa7c37791b

View File

@ -16,9 +16,10 @@ lovebird.wrapprint = true
lovebird.host = "*"
lovebird.port = 8000
lovebird.whitelist = { "127.0.0.1", "localhost" }
lovebird.maxbuffer = 20000
lovebird.maxlines = 200
lovebird.refreshrate = .5
lovebird.buffer = ""
lovebird.lines = {}
local loadstring = loadstring or load
@ -188,11 +189,12 @@ end
function lovebird.print(...)
local str = table.concat(map({...}, tostring), " ") .. "<br>"
lovebird.buffer = lovebird.buffer .. str
if #lovebird.buffer > lovebird.maxbuffer then
lovebird.buffer = lovebird.buffer:sub(-lovebird.maxbuffer)
local str = table.concat(map({...}, tostring), " ")
table.insert(lovebird.lines, str)
if #lovebird.lines > lovebird.maxlines then
table.remove(lovebird.lines, 1)
end
lovebird.buffer = table.concat(lovebird.lines, "<br>")
end