small refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-10-14 11:57:56 +02:00
parent 314e66812b
commit 0ca523e0c5
+1 -1
View File
@@ -9,7 +9,7 @@ nop, id = function() end, function(v) return v end
function define(self, k, v, private)
if type(k) ~= 'string' or not strfind(k, '^[_%a][_%w]*') then error('Invalid identifier "%s".', k) end
local _, _, prefix, suffix = strfind(k, '^(.?.?.?.?)([_%a][_%w]*)')
local _, _, prefix, suffix = strfind(k, '^(.?.?.?.?)([_%a].*)')
local module = loaded[self]
module.defined[k] = module.defined[k] and error('Duplicate identifier "%s".', k) or true
module.fields[k] = v