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:
Arvydas Sidorenko 2012-06-12 10:13:46 +02:00 committed by Uli Schlachter
parent 61ff9ce2b7
commit 997de2726c
1 changed files with 5 additions and 5 deletions

View File

@ -160,7 +160,7 @@ function color.create_radial_pattern(arg)
end
--- Mapping of all supported color types. New entries can be added.
local types = {
color.types = {
solid = color.create_solid_pattern,
png = color.create_png_pattern,
linear = color.create_linear_pattern,
@ -184,15 +184,15 @@ local types = {
function color.create_pattern(col)
if type(col) == "string" then
local t = string.match(col, "[^:]+")
if types[t] then
if color.types[t] then
local pos = string.len(t)
local arg = string.sub(col, pos + 2)
return types[t](arg)
return color.types[t](arg)
end
elseif type(col) == "table" then
local t = col.type
if types[t] then
return types[t](col)
if color.types[t] then
return color.types[t](col)
end
end
return color.create_solid_pattern(col)