From 914c549ee70edecb94addb9cf29d6a3128e9a038 Mon Sep 17 00:00:00 2001 From: LDDestroier Date: Tue, 4 Feb 2020 00:53:49 -0500 Subject: [PATCH] Update windont.lua --- windont/windont.lua | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/windont/windont.lua b/windont/windont.lua index 3e0b684..f66eec2 100644 --- a/windont/windont.lua +++ b/windont/windont.lua @@ -15,6 +15,24 @@ local math_floor = math.floor local to_blit = {} local to_colors = {} +local table_compare = function(tbl1, tbl2) + if type(tbl1) ~= "table" or type(tbl2) ~= "table" then + return tbl1 == tbl2 + else + for k,v in pairs(tbl1) do + if tbl1[k] ~= tbl2[k] then + return false + end + end + for k,v in pairs(tbl2) do + if tbl1[k] ~= tbl2[k] then + return false + end + end + return true + end +end + local getTime = function() return 24 * os.day() + os.time() end @@ -313,9 +331,9 @@ windont.render = function(options, ...) end end if (not oldScreenBuffer[bT]) or (not windont.ignoreUnchangedLines) or (options.force) or ( - table_concat(screenBuffer[1][y]) ~= table_concat(oldScreenBuffer[bT][1][y]) or - table_concat(screenBuffer[2][y]) ~= table_concat(oldScreenBuffer[bT][2][y]) or - table_concat(screenBuffer[3][y]) ~= table_concat(oldScreenBuffer[bT][3][y]) + (not table_compare(screenBuffer[1][y], oldScreenBuffer[bT][1][y])) or + (not table_compare(screenBuffer[2][y], oldScreenBuffer[bT][2][y])) or + (not table_compare(screenBuffer[3][y], oldScreenBuffer[bT][3][y])) ) then for k,v in pairs(blitList) do bT.setCursorPos(k, y)