From e45c59e99a46bf0c9a8a1d75d8c4736f8269b7c1 Mon Sep 17 00:00:00 2001
From: ubq323 <ubq323@ubq323.website>
Date: Fri, 5 Aug 2022 02:42:05 +0100
Subject: pallettete????

---
 img/shitty_disp.lua | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

(limited to 'img')

diff --git a/img/shitty_disp.lua b/img/shitty_disp.lua
index 3f060d9..625e646 100644
--- a/img/shitty_disp.lua
+++ b/img/shitty_disp.lua
@@ -73,13 +73,18 @@ local function median_cut(pxlist,remaining)
 	local hcount = math.floor(count/2)
 
 	local lhalf,uhalf = {},{}
-	table.move(pxlist, 1,hcount, 1, lhalf)
-	table.move(pxlist, hcount+1,count, 1, uhalf)
-
+	for i=1,hcount do
+		lhalf[i] = pxlist[i]
+	end
+	for i=hcount+1,count do
+		uhalf[i-hcount] = pxlist[i]
+	end
+	
 	local lcols = median_cut(lhalf,remaining-1)
 	local ucols = median_cut(uhalf,remaining-1)
-	
-	return table.move(ucols,1,#ucols,#lcols+1,lcols)
+
+	for i=1,#ucols do table.insert(lcols,ucols[i]) end
+	return lcols
 end
 
 local function reset_palette(R)
-- 
cgit v1.2.3