mirror of
https://github.com/TangentFoxy/lovebird.git
synced 2025-07-28 11:02:19 +00:00
Added lovebird.pushline() function
This commit is contained in:
16
lovebird.lua
16
lovebird.lua
@@ -475,6 +475,16 @@ function lovebird.clear()
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function lovebird.pushline(line)
|
||||||
|
line.time = os.time()
|
||||||
|
line.count = 1
|
||||||
|
table.insert(lovebird.lines, line)
|
||||||
|
if #lovebird.lines > lovebird.maxlines then
|
||||||
|
table.remove(lovebird.lines, 1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
function lovebird.print(...)
|
function lovebird.print(...)
|
||||||
local t = {}
|
local t = {}
|
||||||
for i = 1, select("#", ...) do
|
for i = 1, select("#", ...) do
|
||||||
@@ -488,11 +498,7 @@ function lovebird.print(...)
|
|||||||
last.count = last.count + 1
|
last.count = last.count + 1
|
||||||
else
|
else
|
||||||
-- Create new line
|
-- Create new line
|
||||||
local line = { str = str, time = os.time(), count = 1 }
|
lovebird.pushline({ type = "output", str = str })
|
||||||
table.insert(lovebird.lines, line)
|
|
||||||
if #lovebird.lines > lovebird.maxlines then
|
|
||||||
table.remove(lovebird.lines, 1)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
-- Build string buffer from lines
|
-- Build string buffer from lines
|
||||||
local function doline(line)
|
local function doline(line)
|
||||||
|
Reference in New Issue
Block a user