aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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);