bugfix
This commit is contained in:
@@ -6,44 +6,6 @@ public.bids_loaded = false
|
||||
public.current_owner_page = nil
|
||||
public.last_owner_page_requested = nil
|
||||
|
||||
do
|
||||
local mt = {
|
||||
__newindex = function(self, name, method)
|
||||
if strsub(name, 1, 2) == '__' then
|
||||
self._metatable[name] = method
|
||||
else
|
||||
self._methods[name] = method
|
||||
end
|
||||
end,
|
||||
__call = function(self, ...)
|
||||
if self._metatable.__index then
|
||||
setmetatable(self._methods, {__index=self._metatable.__index})
|
||||
self._metatable.__index = self._methods
|
||||
end
|
||||
|
||||
local object = setmetatable({}, self._metatable)
|
||||
self._constructor(object, unpack(arg))
|
||||
return object
|
||||
end,
|
||||
}
|
||||
function public.class(constructor)
|
||||
return setmetatable({_constructor=constructor, _methods={}, _metatable={}}, mt)
|
||||
end
|
||||
end
|
||||
|
||||
--public.dynamic_table = m.class(function(self, f)
|
||||
-- self._f = f
|
||||
--end)
|
||||
--function m.dynamic_table:__newindex(key, value)
|
||||
-- self._f()[key] = value
|
||||
--end
|
||||
--function m.dynamic_table:__index(key)
|
||||
-- return self._f()[key]
|
||||
--end
|
||||
--function m.dynamic_table:__call()
|
||||
-- return self._f()
|
||||
--end
|
||||
|
||||
do
|
||||
local mt = {
|
||||
__newindex = function(self, key, value)
|
||||
|
||||
+7
-7
@@ -6,7 +6,7 @@ local public_interface_mt = {
|
||||
end,
|
||||
__index = function(self, key)
|
||||
if __[self].public[key] then
|
||||
return __[self].data[key]
|
||||
return __[self].attributes[key]
|
||||
else
|
||||
error('Read of undeclared "'..key..'".', 2)
|
||||
end
|
||||
@@ -17,13 +17,13 @@ local private_interface_mt = {
|
||||
if not __[self].declared[key] then
|
||||
error('Write of undeclared "'..key..'".', 2)
|
||||
end
|
||||
__[self].data[key] = value
|
||||
__[self].attributes[key] = value
|
||||
end,
|
||||
__index = function(self, key)
|
||||
if not __[self].declared[key] then
|
||||
error('Read of undeclared "'..key..'".', 2)
|
||||
end
|
||||
return __[self].data[key]
|
||||
return __[self].attributes[key]
|
||||
end,
|
||||
}
|
||||
local public_declarator_mt = {
|
||||
@@ -31,7 +31,7 @@ local public_declarator_mt = {
|
||||
if __[self].declared[key] then
|
||||
error('Multiple declarations of "'..key..'".', 2)
|
||||
end
|
||||
__[self].data[key] = value
|
||||
__[self].attributes[key] = value
|
||||
__[self].public[key] = true
|
||||
__[self].declared[key] = true
|
||||
end,
|
||||
@@ -44,7 +44,7 @@ local private_declarator_mt = {
|
||||
if __[self].declared[key] then
|
||||
error('Multiple declarations of "'..key..'".', 2)
|
||||
end
|
||||
__[self].data[key] = value
|
||||
__[self].attributes[key] = value
|
||||
__[self].declared[key] = true
|
||||
end,
|
||||
__index = function()
|
||||
@@ -53,10 +53,10 @@ local private_declarator_mt = {
|
||||
}
|
||||
|
||||
function aux_module()
|
||||
local dataset = {data={}, public={}, declared={}}
|
||||
local data = {attributes={}, public={}, declared={}}
|
||||
local module = {setmetatable({}, public_interface_mt), setmetatable({}, private_interface_mt), setmetatable({}, public_declarator_mt), setmetatable({}, private_declarator_mt)}
|
||||
for _, component in module do
|
||||
__[component] = dataset
|
||||
__[component] = data
|
||||
end
|
||||
return module
|
||||
end
|
||||
+2
-2
@@ -100,8 +100,8 @@ end
|
||||
|
||||
do
|
||||
local mt = {
|
||||
__call = function(self)
|
||||
return
|
||||
__call = function(self, key)
|
||||
return self[key]
|
||||
end,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user