refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-08-09 10:46:43 +02:00
parent ebd09e051e
commit 44d0b46aa8
6 changed files with 147 additions and 145 deletions
+6 -6
View File
@@ -7,17 +7,17 @@ public.last_owner_page_requested = nil
do
local mt = {
__newindex = function(self, key, value)
self._f()[key] = value
self._getter()[key] = value
end,
__index = function(self, key)
return self._f()[key]
return self._getter()[key]
end,
__call = function(self)
return self._f()
return self._getter()
end,
}
function public.dynamic_table(f)
return setmetatable({_f=f}, mt)
function public.dynamic_table(getter)
return setmetatable({_getter=getter}, mt)
end
end
@@ -177,7 +177,7 @@ end
do
local function cost_label(cost)
local label = LIGHTYELLOW_FONT_COLOR_CODE..'(Total Cost: '..FONT_COLOR_CODE_CLOSE
label = label..(cost and m.util.format_money(cost, nil, LIGHTYELLOW_FONT_COLOR_CODE) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE)
label = label..(cost and m.money.format(cost, nil, LIGHTYELLOW_FONT_COLOR_CODE) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE)
label = label..LIGHTYELLOW_FONT_COLOR_CODE..')'..FONT_COLOR_CODE_CLOSE
return label
end