aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPavel Labath <pavelo@centrum.sk>2011-06-16 19:05:44 (GMT)
committerPaul Tagliamonte <paultag@fluxbox.org>2012-04-07 02:10:41 (GMT)
commit75ad307a404e4e259a028f2dab73e1b370642318 (patch)
treeaa8273f914791b1904de3062c0d83f9793174a7e /src
parentc4b1e8d5117578c05544d480442a1dcd1ce8559b (diff)
downloadfluxbox_paul-75ad307a404e4e259a028f2dab73e1b370642318.zip
fluxbox_paul-75ad307a404e4e259a028f2dab73e1b370642318.tar.bz2
Fix bug in LResources: they were unable to handle resources with numbers in names
Diffstat (limited to 'src')
-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);