From 6a70803b6c83b740f4d5c6296810a247e7d24f1e Mon Sep 17 00:00:00 2001 From: Ollo Date: Sat, 20 Mar 2021 16:07:05 +0100 Subject: [PATCH] Internal variables for swapping --- displayword.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/displayword.lua b/displayword.lua index 6b0f84e..65687f2 100644 --- a/displayword.lua +++ b/displayword.lua @@ -66,11 +66,12 @@ local swapLine = function(data, lineOffset) if (data.rgbBuffer == nil) then return false end - for i = 0,10 do - local tmpColor=data.rgbBuffer:get(lineOffset+i) - data.rgbBuffer:set(lineOffset+i, data.rgbBuffer:get(lineOffset+10-i)) - data.rgbBuffer:set(lineOffset+10-i, tmpColor) + local num=tonumber(lineOffset)+i + local num2=tonumber(lineOffset)+10-i + local tmpColor=data.rgbBuffer:get(num) + data.rgbBuffer:set(num, data.rgbBuffer:get(num2)) + data.rgbBuffer:set(num2, tmpColor) end return true end