From fc96823be8892d559e92da8682dd94fd20d89146 Mon Sep 17 00:00:00 2001 From: rxi Date: Sat, 28 Jun 2014 12:00:53 +0100 Subject: [PATCH] Added function lovebird.recalcbuffer() --- lovebird.lua | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/lovebird.lua b/lovebird.lua index 2429886..bfd3c3d 100644 --- a/lovebird.lua +++ b/lovebird.lua @@ -482,25 +482,11 @@ function lovebird.pushline(line) if #lovebird.lines > lovebird.maxlines then table.remove(lovebird.lines, 1) end + lovebird.recalcbuffer() end -function lovebird.print(...) - local t = {} - for i = 1, select("#", ...) do - table.insert(t, tostring(select(i, ...))) - end - local str = table.concat(t, " ") - local last = lovebird.lines[#lovebird.lines] - if last and str == last.str then - -- Update last line if this line is a duplicate of it - last.time = os.time() - last.count = last.count + 1 - else - -- Create new line - lovebird.pushline({ type = "output", str = str }) - end - -- Build string buffer from lines +function lovebird.recalcbuffer() local function doline(line) local str = line.str if not lovebird.allowhtml then @@ -519,6 +505,25 @@ function lovebird.print(...) end +function lovebird.print(...) + local t = {} + for i = 1, select("#", ...) do + table.insert(t, tostring(select(i, ...))) + end + local str = table.concat(t, " ") + local last = lovebird.lines[#lovebird.lines] + if last and str == last.str then + -- Update last line if this line is a duplicate of it + last.time = os.time() + last.count = last.count + 1 + lovebird.recalcbuffer() + else + -- Create new line + lovebird.pushline({ type = "output", str = str }) + end +end + + function lovebird.onerror(err) lovebird.trace("ERROR:", err) end