From aa7c37791b63d28775903f7ebf99d6a282069f98 Mon Sep 17 00:00:00 2001 From: rxi Date: Thu, 10 Apr 2014 18:23:04 +0100 Subject: [PATCH] Changed buffer to use lines, replaced maxbuffer -> maxlines --- lovebird.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lovebird.lua b/lovebird.lua index bc81e4c..824fb96 100644 --- a/lovebird.lua +++ b/lovebird.lua @@ -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), " ") .. "
" - 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, "
") end