Skip to content

Commit

Permalink
Cleanup PR #9, camelcase, rename, return, declare locals
Browse files Browse the repository at this point in the history
  • Loading branch information
Zren committed May 31, 2022
1 parent 4745720 commit 8076c0a
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions osc_tethys.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,28 +56,26 @@ local tethys = {
}
read_options(tethys, "tethys")

local function col_format(color)
if string.find(color,"#") then
colorU = string.upper(color)
r = string.sub(colorU,2,3)
g = string.sub(colorU,4,5)
b = string.sub(colorU,6,7)
result = b..g..r
local function parseColor(color)
if string.find(color, "#") then
local colorU = string.upper(color)
local r = string.sub(colorU, 2, 3)
local g = string.sub(colorU, 4, 5)
local b = string.sub(colorU, 6, 7)
return b..g..r
else
result = color
return color
end
return result
end

local function fix_values(values_table)
for k,v in pairs (values_table) do
if string.find(k,"Color") then
values_table[k] = col_format(v)
local function parseConfig(configTable)
for k,v in pairs(configTable) do
if string.find(k, "Color") then
configTable[k] = parseColor(v)
end
end
end

fix_values(tethys)
parseConfig(tethys)

tethys.bottomBarHeight = tethys.seekbarHeight + tethys.controlsHeight
tethys.buttonW = tethys.controlsHeight
Expand Down

0 comments on commit 8076c0a

Please sign in to comment.