refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-08-28 18:21:22 +02:00
parent 60d4fc85b3
commit 005fa3c2b6
2 changed files with 61 additions and 66 deletions
+1 -3
View File
@@ -64,8 +64,6 @@ end
local env_mt = {__metatable=false}
function env_mt:__index(key) self=state[self]
local quote = state.quote
if quote then return quote(key) end
local getter = self[INDEX][key]
if getter then return getter() end
return self[CALL][key] or _G[key] or self.declarator[key]
@@ -96,7 +94,7 @@ function module(...)
access = {_=PRIVATE, error=PRIVATE, nop=PRIVATE, _G=PRIVATE, M=PRIVATE, I=PRIVATE, public=PRIVATE, private=PRIVATE},
[CALL] = {error=error, nop=nop},
[INDEX] = {_G=const(_G), M=const(env), I=const(interface), public=function() return declarator.public end, private=function() return declarator.private end},
[NEWINDEX] = {_=nop, quote=function(enable) self.quote = enable and type(enable) == 'function' and enable or tostring end},
[NEWINDEX] = {_=nop},
declarator = declarator,
default_access = PRIVATE,
}