mirror of
https://github.com/pandorabox-io/banners.git
synced 2025-04-20 03:10:22 +02:00
use ipairs feature
or use the faster repeat-until-loop
This commit is contained in:
parent
b1d63fd7b1
commit
b1ff0eb558
18
init.lua
18
init.lua
@ -82,9 +82,9 @@ banners.creation_form_func = function(state)
|
|||||||
-- add banners colors
|
-- add banners colors
|
||||||
local x = 7
|
local x = 7
|
||||||
local y = .3
|
local y = .3
|
||||||
for i in ipairs(banners.colors) do
|
for _, color in ipairs(banners.colors) do
|
||||||
local b = state:button(x, y, 1, 1, banners.colors[i], "")
|
local b = state:button(x, y, 1, 1, color, "")
|
||||||
b:setImage("bg_" .. banners.colors[i] .. ".png")
|
b:setImage("bg_" .. color .. ".png")
|
||||||
b:click(function(self, state2)
|
b:click(function(self, state2)
|
||||||
state2.current_color = "bg_" .. self.name .. ".png"
|
state2.current_color = "bg_" .. self.name .. ".png"
|
||||||
state2:get("color_indicator"):setImage(state2.current_color)
|
state2:get("color_indicator"):setImage(state2.current_color)
|
||||||
@ -99,9 +99,9 @@ banners.creation_form_func = function(state)
|
|||||||
-- add banners buttons
|
-- add banners buttons
|
||||||
x = 1
|
x = 1
|
||||||
y = 3
|
y = 3
|
||||||
for i in ipairs(banners.masks) do
|
for _, mask in ipairs(banners.masks) do
|
||||||
local b = state:button(x, y, 2, 1, banners.masks[i], "")
|
local b = state:button(x, y, 2, 1, mask, "")
|
||||||
b:setImage(banners.masks[i] .. ".png")
|
b:setImage(mask .. ".png")
|
||||||
b:click(function(self, state2)
|
b:click(function(self, state2)
|
||||||
state2.banner:push_transform({
|
state2.banner:push_transform({
|
||||||
texture = state2.current_color,
|
texture = state2.current_color,
|
||||||
@ -140,9 +140,9 @@ function banners.Banner.pop_transform(self)
|
|||||||
end
|
end
|
||||||
function banners.Banner.get_transform_string(self)
|
function banners.Banner.get_transform_string(self)
|
||||||
local final = {}
|
local final = {}
|
||||||
for i in ipairs(self.transforms) do
|
for _, transform in ipairs(self.transforms) do
|
||||||
table.insert(final, "(" .. self.transforms[i].texture
|
table.insert(final, "(" .. transform.texture
|
||||||
.. "^[mask:" .. self.transforms[i].mask .. "^[makealpha:0,0,0)")
|
.. "^[mask:" .. transform.mask .. "^[makealpha:0,0,0)")
|
||||||
end
|
end
|
||||||
local ret = table.concat(final, "^")
|
local ret = table.concat(final, "^")
|
||||||
return ret
|
return ret
|
||||||
|
Loading…
x
Reference in New Issue
Block a user