This commit is contained in:
Manuel Simon Hirsig
2016-09-03 04:00:52 +02:00
parent 0d8f5427b2
commit 0bae9079f9
3 changed files with 6 additions and 5 deletions
+3 -3
View File
@@ -26,10 +26,10 @@ local function prototype() local eq = const(true)
return setmetatable({__metatable=false, __eq=eq}, {__metatable=false, __eq=eq, __call=function(self, t) return setmetatable(t, self) end})
end
local state = {}
local INTERFACE, ENVIRONMENT, DECLARATOR = prototype(), prototype(), prototype()
local state = {}
function INTERFACE:__index(key) self=state[self]
if self.access[key] == PUBLIC then
local getter = self[INDEX][key]
@@ -112,7 +112,7 @@ function module(name)
access = {inspect=PRIVATE, _=PRIVATE, error=PRIVATE, nop=PRIVATE, _G=PRIVATE, M=PRIVATE, I=PRIVATE, public=PRIVATE, private=PRIVATE},
[CALL] = {inspect=inspect, import=function(interface) import(self, interface) end, 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},
[NEWINDEX] = {inspect=inspect, _=nop},
declarator = declarator,
default_access = PRIVATE,
}