refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-08-26 19:28:53 +02:00
parent 5ad3ba3d82
commit 6a8f1eab9a
+3 -2
View File
@@ -40,7 +40,7 @@ do
if name then
type = TYPE[key] or declaration_error()
else
name = key
name = key -- TODO tostring if value nil?
if typeof(value) == 'function' then type = CALL else type, value = INDEX, const(value) end
end
declare(self, access, name, {[type]=value})
@@ -71,7 +71,8 @@ do
function env_mt:__newindex(key, value) local state=_state[self]
if declaration(state, NEWINDEX, key, value) then return end
local newindex = state[NEWINDEX][key]
if newindex then newindex(value) else declare(state, nil, nil, key, value) end
if newindex then newindex(value); return end
start_declaration(state); declaration(state, NEWINDEX, key, value)
end
function env_mt:__call(key, value)
declaration(_state[self], CALL, key, value)