aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Labath <pavelo@centrum.sk>2011-06-16 19:05:44 (GMT)
committerPavel Labath <pavelo@centrum.sk>2013-02-16 23:51:49 (GMT)
commit590efd07bb2ed1ce78ce6e5e6750b57311904f1f (patch)
tree8add0455e5ef4ce6622f830a757a725d6f23b027
parent2846f984b527ae54f7a7678516787e850566c7c9 (diff)
downloadfluxbox_pavel-590efd07bb2ed1ce78ce6e5e6750b57311904f1f.zip
fluxbox_pavel-590efd07bb2ed1ce78ce6e5e6750b57311904f1f.tar.bz2
Fix bug in LResources: they were unable to handle resources with numbers in names
-rw-r--r--src/FbTk/LResourceHelper.lua12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/FbTk/LResourceHelper.lua b/src/FbTk/LResourceHelper.lua
index b16e756..e2899f8 100644
--- a/src/FbTk/LResourceHelper.lua
+++ b/src/FbTk/LResourceHelper.lua
@@ -54,7 +54,7 @@ local function index(table, key)
54end; 54end;
55 55
56local function append_name(str, name) 56local function append_name(str, name)
57 if type(name) == 'string' and string.match(name, '^%a+$') then 57 if type(name) == 'string' and string.match(name, '^%a%w*$') then
58 return str .. '.' .. name; 58 return str .. '.' .. name;
59 elseif type(name) == 'number' then 59 elseif type(name) == 'number' then
60 return str .. '[' .. string.format('%g', name) .. ']'; 60 return str .. '[' .. string.format('%g', name) .. ']';
@@ -77,14 +77,14 @@ local function register_resource(root, name, object)
77 local meta = getmetatable(root); 77 local meta = getmetatable(root);
78 meta._state = 1; 78 meta._state = 1;
79 79
80 local head, tail = string.match(name, '^(%a+)%.?(.*)'); 80 local head, tail = string.match(name, '^(%a%w*)%.?(.*)');
81 local t = meta[head]; 81 local t = meta[head];
82 local mt = getmetatable(t); 82 local mt = getmetatable(t);
83 if mt ~= nil and mt._magic == cat_magic then
84 t = mt;
85 end;
86 83
87 if tail == '' then 84 if tail == '' then
85 if mt ~= nil and mt._magic == cat_magic then
86 t = mt;
87 end;
88 if getmetatable(object) == res_magic then 88 if getmetatable(object) == res_magic then
89 meta[head] = object; 89 meta[head] = object;
90 write_resource(object, t); 90 write_resource(object, t);
@@ -95,7 +95,7 @@ local function register_resource(root, name, object)
95 return t; 95 return t;
96 end; 96 end;
97 97
98 if t == nil then 98 if mt == nil or mt._magic ~= cat_magic then
99 t = new_cat(root, head); 99 t = new_cat(root, head);
100 end; 100 end;
101 return register_resource(t, tail, object); 101 return register_resource(t, tail, object);