big refactoring
This commit is contained in:
+5
-5
@@ -15,15 +15,15 @@ end
|
||||
|
||||
do
|
||||
local value, charges
|
||||
local function setter(n)
|
||||
local function mutator(n)
|
||||
return function(v)
|
||||
assert(charges == 0)
|
||||
value, charges = v, n
|
||||
return v
|
||||
end
|
||||
end
|
||||
for i=1,9 do public[join{replicate(i, 'x')}] = setter(i) end
|
||||
function public.getter.__()
|
||||
for i=1,9 do public[join{replicate(i, 'x')}] = mutator(i) end
|
||||
function public.accessor.__()
|
||||
assert(charges > 0)
|
||||
charges = charges - 1
|
||||
return value
|
||||
@@ -85,7 +85,7 @@ end
|
||||
|
||||
public.huge = 1.8*10^308
|
||||
|
||||
function public.getter.modified() return IsShiftKeyDown() or IsControlKeyDown() or IsAltKeyDown() end
|
||||
function public.accessor.modified() return IsShiftKeyDown() or IsControlKeyDown() or IsAltKeyDown() end
|
||||
|
||||
--do TODO
|
||||
-- local _state = setmetatable({}, {__mode='kv'})
|
||||
@@ -233,7 +233,7 @@ end
|
||||
|
||||
function public.round(x) return floor(x + 0.5) end
|
||||
|
||||
function public.getter.inventory()
|
||||
function public.accessor.inventory()
|
||||
local bag, slot = 0, 0
|
||||
return function()
|
||||
if not GetBagName(bag) or slot >= GetContainerNumSlots(bag) then
|
||||
|
||||
+2
-2
@@ -267,10 +267,10 @@ function public.auctionable(tooltip, quality, lootable)
|
||||
and not (durability and durability < max_durability)
|
||||
end
|
||||
|
||||
function public.tooltip(setter)
|
||||
function public.tooltip(mutator)
|
||||
AuxTooltip:SetOwner(UIParent, 'ANCHOR_NONE')
|
||||
AuxTooltip.money = 0
|
||||
setter(AuxTooltip)
|
||||
mutator(AuxTooltip)
|
||||
AuxTooltip:Show()
|
||||
|
||||
local tooltip = {}
|
||||
|
||||
@@ -10,7 +10,7 @@ do
|
||||
realm = GetCVar 'realmName'
|
||||
end
|
||||
|
||||
function getter.dataset_key() return realm..'|'..faction end
|
||||
function accessor.dataset_key() return realm..'|'..faction end
|
||||
end
|
||||
|
||||
function public.load_dataset()
|
||||
@@ -26,7 +26,7 @@ end
|
||||
-- end,
|
||||
-- __call = function(self, field) end
|
||||
-- }
|
||||
-- function public.getter.record()
|
||||
-- function public.accessor.record()
|
||||
--
|
||||
-- end
|
||||
--end
|
||||
|
||||
Reference in New Issue
Block a user