Reworked require with dofile

This commit is contained in:
ollo
2019-05-03 20:19:12 +02:00
parent 97de5dbb78
commit c3e48fb17a
2 changed files with 22 additions and 19 deletions

View File

@@ -1,16 +1,12 @@
-- Module filling a buffer, sent to the LEDs
local moduleName = ...
local M = {} -- public interface
_G[moduleName] = M
function M.updateColor(data, inverseRow)
local M
do
local updateColor = function (data, inverseRow)
--FIXME magic missing to start on the left side
return data.colorFg
end
function M.drawLEDs(data, numberNewChars, inverseRow)
local drawLEDs = function(data, numberNewChars, inverseRow)
if (inverseRow == nil) then
inverseRow=false
end
@@ -30,7 +26,7 @@ function M.drawLEDs(data, numberNewChars, inverseRow)
end
-- Utility function for round
function M.round(num)
local round = function(num)
under = math.floor(num)
upper = math.floor(num) + 1
underV = -(under - num)
@@ -47,7 +43,7 @@ local briPercent=50
local data={}
-- Module displaying of the words
function M.generateLEDs(words, colorForground, colorMin1, colorMin2, colorMin3, colorMin4)
local generateLEDs = function(words, colorForground, colorMin1, colorMin2, colorMin3, colorMin4)
-- Set the local variables needed for the colored progress bar
data={}
@@ -248,3 +244,11 @@ if (words.fiveMin== 1) then
collectgarbage()
return buf
end
M = {
generateLEDs = generateLEDs,
round = round,
drawLEDs = drawLEDs,
updateColor = updateColor,
}
end
return M