Ported lib/gears to lua 5.2
Tested with lua 5.1: all good Signed-off-by: Arvydas Sidorenko <asido4@gmail.com> Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
61ff9ce2b7
commit
997de2726c
|
@ -160,7 +160,7 @@ function color.create_radial_pattern(arg)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Mapping of all supported color types. New entries can be added.
|
--- Mapping of all supported color types. New entries can be added.
|
||||||
local types = {
|
color.types = {
|
||||||
solid = color.create_solid_pattern,
|
solid = color.create_solid_pattern,
|
||||||
png = color.create_png_pattern,
|
png = color.create_png_pattern,
|
||||||
linear = color.create_linear_pattern,
|
linear = color.create_linear_pattern,
|
||||||
|
@ -184,15 +184,15 @@ local types = {
|
||||||
function color.create_pattern(col)
|
function color.create_pattern(col)
|
||||||
if type(col) == "string" then
|
if type(col) == "string" then
|
||||||
local t = string.match(col, "[^:]+")
|
local t = string.match(col, "[^:]+")
|
||||||
if types[t] then
|
if color.types[t] then
|
||||||
local pos = string.len(t)
|
local pos = string.len(t)
|
||||||
local arg = string.sub(col, pos + 2)
|
local arg = string.sub(col, pos + 2)
|
||||||
return types[t](arg)
|
return color.types[t](arg)
|
||||||
end
|
end
|
||||||
elseif type(col) == "table" then
|
elseif type(col) == "table" then
|
||||||
local t = col.type
|
local t = col.type
|
||||||
if types[t] then
|
if color.types[t] then
|
||||||
return types[t](col)
|
return color.types[t](col)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return color.create_solid_pattern(col)
|
return color.create_solid_pattern(col)
|
||||||
|
|
Loading…
Reference in New Issue