diff --git a/example/demo.lua b/example/demo.lua index c0e76b2..0ea5038 100644 --- a/example/demo.lua +++ b/example/demo.lua @@ -13,12 +13,8 @@ end local function makeMainComponent() local lnf = juce.LookAndFeel_V4.new() - function lnf:drawButtonBackground(g, btn, color, highlighted, down) - local b = btn:getBounds() - local bf = juce.Rectangle_int.new(b:getX(), b:getY(), b:getWidth(), - b:getHeight()) - local c = highlighted and juce.Colours.red or juce.Colours.blue - g:setColour(c) + function lnf:drawButtonBackground(g, btn, colour, highlighted, down) + g:setColour(highlighted and colour or juce.Colours.blue) g:fillAll() end diff --git a/example/jml/equalizer.lua b/example/jml/equalizer.lua index 40f89e1..108b587 100644 --- a/example/jml/equalizer.lua +++ b/example/jml/equalizer.lua @@ -1,4 +1,4 @@ -jml = require("jml") +local jml = require("jml") local eq = {} diff --git a/example/jml/jml.lua b/example/jml/jml.lua index 4ebc080..93756f0 100644 --- a/example/jml/jml.lua +++ b/example/jml/jml.lua @@ -15,23 +15,12 @@ end local function getTableSize(t) assert(isTable(t)) local count = 0 - for k in pairs(t) do + for _ in pairs(t) do count = count + 1 end return count end -local function max(lhs, rhs) - assert(isNumber(lhs)) - assert(isNumber(rhs)) - - if lhs > rhs then - return lhs - end - - return rhs -end - local function setEmptyProperties(spec, properties) assert(isTable(spec)) assert(isTable(properties)) @@ -45,7 +34,7 @@ local function setEmptyProperties(spec, properties) {"margin", 0}, } - local addProperty = function(k, v) + local addProperty = function(_, v) local id = v[1] local value = v[2] if spec[id] == nil then @@ -64,19 +53,19 @@ local function setEmptyProperties(spec, properties) return spec end -function isPercentageString(str) +local function isPercentageString(str) if type(str) == "string" then return str:sub(-1) == "%" end return false end -function parsePercentageToFraction(str) +local function parsePercentageToFraction(str) assert(isString(str)) return tonumber(str:sub(1, -2)) / 100.0 end -function calculatePercentageBasedSize(parentSize, children, property) +local function calculatePercentageBasedSize(parentSize, children, property) assert(isNumber(parentSize)) assert(isTable(children)) assert(isString(property)) @@ -156,7 +145,7 @@ function jml.Component(spec) component:setComponentID(juce.String.new(spec.id)) -- CHILDREN - for k, child in ipairs(spec.children) do + for _, child in ipairs(spec.children) do child.component = child.build() component:addAndMakeVisible(child.component) end diff --git a/example/jml/main.lua b/example/jml/main.lua index 804f5ae..9b47ba4 100644 --- a/example/jml/main.lua +++ b/example/jml/main.lua @@ -1,4 +1,4 @@ -jml = require("jml") +local jml = require("jml") local ui = jml.Component{ id = "Main Window",