From 4414ccf084835178c012b60934c5e3fddb2930ec Mon Sep 17 00:00:00 2001 From: Manuel Simon Hirsig Date: Thu, 29 Sep 2016 23:45:44 +0200 Subject: [PATCH] bugfix in module library and new class encapsulation --- libs/module.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/module.lua b/libs/module.lua index 294a6c5..0f254ad 100644 --- a/libs/module.lua +++ b/libs/module.lua @@ -29,9 +29,9 @@ end function definition_helper_mt:__newindex(k, v) local module, modifiers = _module[self], _modifiers[self] local access = ACCESS[tremove(modifiers, 1)] or error'Definition missing access modifier.' local name = META[k] and (tremove(modifiers) or error'Definition missing identifier.') or k - if type(name) ~= 'string' or not strfind(name, '^[_%a][_%w]*') then error('"%s" is not a valid identifier.', name) end + if type(name) ~= 'string' or not strfind(name, '^[_%a][_%w]*') then error('Invalid identifier "%s".', name) end local type = META[k] or FIELD - module.defined[name .. OPERATION[type]] = module.defined[name .. OPERATION[type]] and error('"%s" already exists.', name) or true + module.defined[name .. OPERATION[type]] = module.defined[name .. OPERATION[type]] and error('Duplicate identifier "%s".', name) or true for i = getn(modifiers), 1, -1 do v = module[FIELD][modifiers[i]](v) end module[type][name], module[access+type][name] = v, v setn(modifiers, 0)