refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-08-23 04:58:46 +02:00
parent 85d2e578e4
commit 5f03b95e8f
26 changed files with 209 additions and 225 deletions
+30 -41
View File
@@ -10,7 +10,7 @@ do
CreateFrame'Frame':SetScript('OnUpdate', function() CreateFrame'Frame':SetScript('OnUpdate', function()
for t in temporary do for t in temporary do
recycle(t) recycle(t)
log(getn(table_pool)) -- log(getn(table_pool))
end end
wipe(temporary) wipe(temporary)
end) end)
@@ -33,21 +33,12 @@ do
tremove(table_pool) or {} tremove(table_pool) or {}
end end
function public.accessor.tt() -- TODO or 'tmp'? function public.accessor.tt() -- TODO or 'tmp'? t (and t -> T)?
local t = tremove(table_pool) or {} local t = tremove(table_pool) or {}
temporary[t] = true temporary[t] = true
return t return t
end end
do
local T = t
local mt = {__unm=function(self) T = t; return setmetatable(self, nil) end}
function public.accessor.T()
wipe(T)
return setmetatable(T, mt)
end
end
function public.modifier(f) function public.modifier(f)
local function apply(_, value) return f(value) end local function apply(_, value) return f(value) end
return setmetatable(t, { return setmetatable(t, {
@@ -57,16 +48,16 @@ do
end end
local temp, perm = modifier(function(t) temporary[t] = true; return t end), modifier(function(t) temporary[t] = false; return t end) local temp, perm = modifier(function(t) temporary[t] = true; return t end), modifier(function(t) temporary[t] = false; return t end)
public.temp() -- TODO or 'auto'? public.temp() -- TODO or 'auto'?
function accessor() return setmetatable(T, mt) end function accessor() return setmetatable(tt, mt) end
function mutator(value) return temp(value) end function mutator(value) return temp(value) end
public.perm() -- TODO or 'keep'? public.perm() -- TODO or 'keep'?
function accessor() return setmetatable(T, mt) end function accessor() return setmetatable(tt, mt) end
function mutator(value) return perm(value) end function mutator(value) return perm(value) end
function public.collector_mt(f) function public.collector_mt(f)
return { return {
__unm=function(self) __unm=function(self)
setmetatable(self, nil) return setmetatable(self, nil)
end, end,
__index=function(self, key) __index=function(self, key)
f(self, key) f(self, key)
@@ -81,7 +72,7 @@ do
do do
local mt = collector_mt(tinsert) local mt = collector_mt(tinsert)
function public.accessor.list() function public.accessor.list()
return setmetatable(T, mt) return setmetatable(tt, mt)
end end
end end
do do
@@ -89,7 +80,7 @@ do
rawset(self, value, true) rawset(self, value, true)
end) end)
function public.accessor.set() function public.accessor.set()
return setmetatable(T, mt) return setmetatable(tt, mt)
end end
end end
do do
@@ -97,12 +88,13 @@ do
local mt = collector_mt(function(self, value) local mt = collector_mt(function(self, value)
if key ~= nil then if key ~= nil then
rawset(self, key, value) rawset(self, key, value)
key = nil
else else
key = value key = value
end end
end) end)
function public.accessor.map() function public.accessor.object()
return setmetatable(T, mt) return setmetatable(tt, mt)
end end
end end
end end
@@ -131,17 +123,17 @@ do
end) end)
end end
function public.log(...) function public.log(...) temp=arg
local msg = '[aux]' local msg = '[aux]'
for i=1,arg.n do msg = msg..' '..tostring(arg[i]) end for i=1,arg.n do msg = msg..' '..tostring(arg[i]) end
DEFAULT_CHAT_FRAME:AddMessage(LIGHTYELLOW_FONT_COLOR_CODE..msg) DEFAULT_CHAT_FRAME:AddMessage(LIGHTYELLOW_FONT_COLOR_CODE..msg)
recycle(arg)
end end
tabs = t tab_info = t
for k, v in map :search_tab 'Search' :post_tab 'Post' :auctions_tab 'Auctions' :bids_tab 'Bids' do for k, v in -object :search_tab 'Search' :post_tab 'Post' :auctions_tab 'Auctions' :bids_tab 'Bids' do
local m, tab = _m, -map :name(k) :title(v) local m, tab = _m, -object :name(v);
log(tab.name);
(function() (function()
module(k) module(k)
function mutator.OPEN(f) tab.OPEN = f end function mutator.OPEN(f) tab.OPEN = f end
@@ -150,12 +142,12 @@ for k, v in map :search_tab 'Search' :post_tab 'Post' :auctions_tab 'Auctions' :
function mutator.CLICK_LINK(f) tab.CLICK_LINK = f end function mutator.CLICK_LINK(f) tab.CLICK_LINK = f end
function public.accessor.ACTIVE() return tab == m.active_tab end function public.accessor.ACTIVE() return tab == m.active_tab end
end)() end)()
tinsert(tab, tabs) tinsert(tab_info, tab)
end end
do do
local active_tab_index local active_tab_index
function accessor.active_tab() return tabs[active_tab_index] end function accessor.active_tab() return tab_info[active_tab_index] end
function on_tab_click(index) function on_tab_click(index)
call(active_tab_index and active_tab.CLOSE) call(active_tab_index and active_tab.CLOSE)
active_tab_index = index active_tab_index = index
@@ -163,8 +155,8 @@ do
end end
end end
function SetItemRef(...) temp(arg) function SetItemRef(...) temp=arg
if arg[3] ~= 'RightButton' or not index(active_tab, 'env', 'CLICK_LINK') or not strfind(arg[1], '^item:%d+') then if arg[3] ~= 'RightButton' or not index(active_tab, 'CLICK_LINK') or not strfind(arg[1], '^item:%d+') then
return orig.SetItemRef(unpack(arg)) return orig.SetItemRef(unpack(arg))
end end
for item_info in present(info.item(tonumber(select(3, strfind(arg[1], '^item:(%d+)'))))) do for item_info in present(info.item(tonumber(select(3, strfind(arg[1], '^item:(%d+)'))))) do
@@ -172,17 +164,17 @@ function SetItemRef(...) temp(arg)
end end
end end
function UseContainerItem(...) temp(arg) function UseContainerItem(...) temp=arg
if modified or not index(active_tab, 'env', 'USE_ITEM') then if modified or not index(active_tab, 'USE_ITEM') then
return orig.UseContainerItem(unpack(arg)) return orig.UseContainerItem(unpack(arg))
end end
for item_info in present(info.container_item(arg[1], arg[2])) do for item_info in present(info.container_item(arg[1], arg[2])) do
return active_tab.env.USE_ITEM(item_info) return active_tab.USE_ITEM(item_info)
end end
end end
public.orig = setmetatable({[_g]=t}, {__index=function(self, key) return self[_g][key] end}) public.orig = setmetatable({[_g]=t}, {__index=function(self, key) return self[_g][key] end})
function public.hook() function public.hook(...)
local name, object, handler local name, object, handler
if arg.n == 3 then if arg.n == 3 then
name, object, handler = unpack(arg) name, object, handler = unpack(arg)
@@ -248,7 +240,7 @@ end
function AUCTION_HOUSE_SHOW() function AUCTION_HOUSE_SHOW()
AuctionFrame:Hide() AuctionFrame:Hide()
frame:Show() aux_frame:Show()
set_tab(1) set_tab(1)
end end
@@ -259,7 +251,7 @@ function AUCTION_HOUSE_CLOSED()
stack.stop() stack.stop()
scan.abort() scan.abort()
set_tab() set_tab()
frame:Hide() aux_frame:Hide()
end end
function AUCTION_BIDDER_LIST_UPDATE() function AUCTION_BIDDER_LIST_UPDATE()
@@ -268,7 +260,7 @@ end
do do
local last_owner_page_requested local last_owner_page_requested
function GetOwnerAuctionItems(...) temp(arg) function GetOwnerAuctionItems(...) temp=arg
local page = arg[1] local page = arg[1]
last_owner_page_requested = page last_owner_page_requested = page
return orig.GetOwnerAuctionItems(unpack(arg)) return orig.GetOwnerAuctionItems(unpack(arg))
@@ -281,7 +273,7 @@ end
function ADDON_LOADED.Blizzard_AuctionUI() function ADDON_LOADED.Blizzard_AuctionUI()
AuctionFrame:UnregisterEvent 'AUCTION_HOUSE_SHOW' AuctionFrame:UnregisterEvent 'AUCTION_HOUSE_SHOW'
AuctionFrame:SetScript('OnHide', nil) AuctionFrame:SetScript('OnHide', nil)
hook('ShowUIPanel', function(...) temp(arg) hook('ShowUIPanel', function(...) temp=arg
if arg[1] == AuctionFrame then return AuctionFrame:Show() end if arg[1] == AuctionFrame then return AuctionFrame:Show() end
return orig.ShowUIPanel(unpack(arg)) return orig.ShowUIPanel(unpack(arg))
end) end)
@@ -296,8 +288,7 @@ do
return label return label
end end
function ADDON_LOADED.Blizzard_CraftUI() function ADDON_LOADED.Blizzard_CraftUI()
hook('CraftFrame_SetSelection', function(...) hook('CraftFrame_SetSelection', function(...) temp=arg
temp(arg)
local results = {orig.CraftFrame_SetSelection(unpack(arg))} local results = {orig.CraftFrame_SetSelection(unpack(arg))}
local id = GetCraftSelectionIndex() local id = GetCraftSelectionIndex()
local reagent_count = GetCraftNumReagents(id) local reagent_count = GetCraftNumReagents(id)
@@ -324,8 +315,7 @@ do
end) end)
end end
function ADDON_LOADED.Blizzard_TradeSkillUI() function ADDON_LOADED.Blizzard_TradeSkillUI()
hook('TradeSkillFrame_SetSelection', function(...) hook('TradeSkillFrame_SetSelection', function(...) temp=arg
temp(arg)
local results = {orig.TradeSkillFrame_SetSelection(unpack(arg))} local results = {orig.TradeSkillFrame_SetSelection(unpack(arg))}
local id = GetTradeSkillSelectionIndex() local id = GetTradeSkillSelectionIndex()
local reagent_count = GetTradeSkillNumReagents(id) local reagent_count = GetTradeSkillNumReagents(id)
@@ -353,8 +343,7 @@ do
end end
end end
function AuctionFrameAuctions_OnEvent(...) function AuctionFrameAuctions_OnEvent(...) temp=arg
temp(arg)
if AuctionFrameAuctions:IsVisible() then if AuctionFrameAuctions:IsVisible() then
return orig.AuctionFrameAuctions_OnEvent(unpack(arg)) return orig.AuctionFrameAuctions_OnEvent(unpack(arg))
end end
+4 -4
View File
@@ -61,7 +61,7 @@ end
function public.event_listener(event, cb) function public.event_listener(event, cb)
local listener_id = id local listener_id = id
listeners[listener_id] = {event=event, cb=cb, kill=function(...) if arg.n == 0 or arg[1] then kill_listener(listener_id) end end} listeners[listener_id] = {event=event, cb=cb, kill=function(...) temp=arg if arg.n == 0 or arg[1] then kill_listener(listener_id) end end}
event_frame:RegisterEvent(event) event_frame:RegisterEvent(event)
return listener_id return listener_id
end end
@@ -73,13 +73,13 @@ function public.on_next_event(event, callback)
end) end)
end end
function public.thread(k, ...) function public.thread(k, ...) temp=arg
local thread_id = id local thread_id = id
threads[thread_id] = {k = L(k, unpack(arg))} threads[thread_id] = {k = L(k, unpack(arg))}
return thread_id return thread_id
end end
function public.wait(k, ...) function public.wait(k, ...) temp=arg
if type(k) == 'number' then if type(k) == 'number' then
when(function() k = k - 1 return k <= 1 end, unpack(arg)) when(function() k = k - 1 return k <= 1 end, unpack(arg))
else else
@@ -87,7 +87,7 @@ function public.wait(k, ...)
end end
end end
function public.when(p, k, ...) function public.when(p, k, ...) temp=arg
if p() then if p() then
return k(unpack(arg)) return k(unpack(arg))
else else
+1 -1
View File
@@ -45,7 +45,7 @@ end
function accessor.query() return state.params.queries[state.query_index] end function accessor.query() return state.params.queries[state.query_index] end
function wait_for_callback(...) function wait_for_callback(...) temp=arg
local send_signal, signal_received = signal() local send_signal, signal_received = signal()
local suspended local suspended
local ret local ret
+8 -9
View File
@@ -1,5 +1,4 @@
module 'tooltip' module 'tooltip'
--import 'gui' 'lol' 'kek'
_g.aux_tooltip_value = true _g.aux_tooltip_value = true
@@ -10,7 +9,7 @@ game_tooltip_money = nil
function LOAD() function LOAD()
for name, f in game_tooltip_hooks do for name, f in game_tooltip_hooks do
local name, f = name, f local name, f = name, f
_m.hook(name, GameTooltip, function(...) temp(arg) _m.hook(name, GameTooltip, function(...) temp=arg
hooked_setter = true hooked_setter = true
game_tooltip_money = 0 game_tooltip_money = 0
local ret = {orig[GameTooltip][name](unpack(arg))} local ret = {orig[GameTooltip][name](unpack(arg))}
@@ -20,7 +19,7 @@ function LOAD()
end) end)
end end
local orig = SetItemRef local orig = SetItemRef
setglobal('SetItemRef', function(...) setglobal('SetItemRef', function(...) temp=arg
local result = orig(unpack(arg)) local result = orig(unpack(arg))
local name, _, quality = GetItemInfo(arg[1]) local name, _, quality = GetItemInfo(arg[1])
if not IsShiftKeyDown() and not IsControlKeyDown() and name then if not IsShiftKeyDown() and not IsControlKeyDown() and name then
@@ -31,7 +30,7 @@ function LOAD()
return result return result
end) end)
local orig = GameTooltip:GetScript('OnTooltipAddMoney') local orig = GameTooltip:GetScript('OnTooltipAddMoney')
GameTooltip:SetScript('OnTooltipAddMoney', function(...) GameTooltip:SetScript('OnTooltipAddMoney', function(...) temp=arg
if hooked_setter then if hooked_setter then
game_tooltip_money = arg1 game_tooltip_money = arg1
else else
@@ -127,7 +126,7 @@ end
function game_tooltip_hooks:SetHyperlink(itemstring) function game_tooltip_hooks:SetHyperlink(itemstring)
local name, _, quality = GetItemInfo(itemstring) local name, _, quality = GetItemInfo(itemstring)
if name then if name then
local _, _, _, hex = GetItemQualityColor(quality) local hex = select(4, GetItemQualityColor(quality))
local link = hex.. '|H'..itemstring..'|h['..name..']|h'..FONT_COLOR_CODE_CLOSE local link = hex.. '|H'..itemstring..'|h['..name..']|h'..FONT_COLOR_CODE_CLOSE
extend_tooltip(GameTooltip, link, 1) extend_tooltip(GameTooltip, link, 1)
end end
@@ -179,7 +178,7 @@ function game_tooltip_hooks:SetInboxItem(index)
local id = name and cache.item_id(name) local id = name and cache.item_id(name)
if id then if id then
local _, itemstring, quality = GetItemInfo(id) local _, itemstring, quality = GetItemInfo(id)
local _, _, _, hex = GetItemQualityColor(tonumber(quality)) local hex = select(4, GetItemQualityColor(tonumber(quality)))
local link = hex.. '|H'..itemstring..'|h['..name..']|h'..FONT_COLOR_CODE_CLOSE local link = hex.. '|H'..itemstring..'|h['..name..']|h'..FONT_COLOR_CODE_CLOSE
extend_tooltip(GameTooltip, link, quantity) extend_tooltip(GameTooltip, link, quantity)
end end
@@ -195,7 +194,7 @@ end
function game_tooltip_hooks:SetMerchantItem(slot) function game_tooltip_hooks:SetMerchantItem(slot)
local link = GetMerchantItemLink(slot) local link = GetMerchantItemLink(slot)
if link then if link then
local _, _, _, quantity = GetMerchantItemInfo(slot) local quantity = select(4, GetMerchantItemInfo(slot))
extend_tooltip(GameTooltip, link, quantity) extend_tooltip(GameTooltip, link, quantity)
end end
end end
@@ -213,8 +212,8 @@ function game_tooltip_hooks:SetCraftItem(skill, slot)
end end
function game_tooltip_hooks:SetCraftSpell(slot) function game_tooltip_hooks:SetCraftSpell(slot)
if x(GetCraftItemLink(slot)) then for link in present(GetCraftItemLink(slot)) do
extend_tooltip(GameTooltip, __, 1) extend_tooltip(GameTooltip, link, 1)
end end
end end
+2 -2
View File
@@ -926,7 +926,7 @@ local methods = {
end end
end, end,
SetSort = function(self, ...) SetSort = function(self, ...) temp=arg
for k=1,arg.n do for k=1,arg.n do
for i, sort in self.sorts do for i, sort in self.sorts do
if sort.index == abs(arg[k]) then if sort.index == abs(arg[k]) then
@@ -934,7 +934,7 @@ local methods = {
break break
end end
end end
tinsert(self.sorts, 1, { index = abs(arg[k]), descending = arg[k] < 0 }) tinsert(self.sorts, 1, {index=abs(arg[k]), descending=arg[k] < 0 })
end end
self.isSorted = nil self.isSorted = nil
+74 -73
View File
@@ -1,5 +1,79 @@
module 'gui' module 'gui'
function LOAD()
do
local blizzard_backdrop, aux_background, aux_border
aux_border = DropDownList1:CreateTexture()
aux_border:SetTexture(1, 1, 1, .02)
aux_border:SetPoint('TOPLEFT', DropDownList1Backdrop, 'TOPLEFT', -2, 2)
aux_border:SetPoint('BOTTOMRIGHT', DropDownList1Backdrop, 'BOTTOMRIGHT', 1.5, -1.5)
aux_border:SetBlendMode 'ADD'
aux_background = DropDownList1:CreateTexture(nil, 'OVERLAY')
aux_background:SetTexture(color.content.background())
aux_background:SetAllPoints(DropDownList1Backdrop)
blizzard_backdrop = DropDownList1Backdrop:GetBackdrop()
hook('ToggleDropDownMenu', function(...) temp=arg
local ret = {orig.ToggleDropDownMenu(unpack(arg)) }
local dropdown = _g[arg[4] or ''] or this:GetParent()
if strfind(dropdown:GetName() or '', '^aux_frame%d+$') then
set_aux_dropdown_style(dropdown)
else
set_blizzard_dropdown_style()
end
return unpack(ret)
end)
function set_aux_dropdown_style(dropdown)
DropDownList1Backdrop:SetBackdrop{}
aux_border:Show()
aux_background:Show()
DropDownList1:SetWidth(dropdown:GetWidth() * 0.9)
DropDownList1:SetHeight(DropDownList1:GetHeight() - 10)
DropDownList1:ClearAllPoints()
DropDownList1:SetPoint('TOPLEFT', dropdown, 'BOTTOMLEFT', -2, -2)
for i=1,UIDROPDOWNMENU_MAXBUTTONS do
local button = _g['DropDownList1Button'..i]
button:SetPoint('TOPLEFT', 0, -((button:GetID() - 1) * UIDROPDOWNMENU_BUTTON_HEIGHT) - 7)
button:SetPoint('TOPRIGHT', 0, -((button:GetID() - 1) * UIDROPDOWNMENU_BUTTON_HEIGHT) - 7)
local text = button:GetFontString()
text:SetFont(font, font_size.small2)
text:SetPoint('TOPLEFT', 18, 0)
text:SetPoint('BOTTOMRIGHT', -8, 0)
local highlight = _g['DropDownList1Button'..i..'Highlight']
highlight:ClearAllPoints()
highlight:SetDrawLayer 'OVERLAY'
highlight:SetHeight(14)
highlight:SetPoint('LEFT', 5, 0)
highlight:SetPoint('RIGHT', -3, 0)
local check = _g['DropDownList1Button'..i..'Check']
check:SetWidth(16)
check:SetHeight(16)
check:SetPoint('LEFT', 3, -1)
end
end
function set_blizzard_dropdown_style()
DropDownList1Backdrop:SetBackdrop(blizzard_backdrop)
aux_border:Hide()
aux_background:Hide()
for i=1,UIDROPDOWNMENU_MAXBUTTONS do
local button = _g['DropDownList1Button'..i]
local text = button:GetFontString()
text:SetFont([[Fonts\FRIZQT__.ttf]], 10)
text:SetShadowOffset(1, -1)
local highlight = _g['DropDownList1Button'..i..'Highlight']
highlight:SetAllPoints()
highlight:SetDrawLayer 'BACKGROUND'
local check = _g['DropDownList1Button'..i..'Check']
check:SetWidth(24)
check:SetHeight(24)
check:SetPoint('LEFT', 0, 0)
end
end
end
end
public.font = [[Fonts\ARIALN.TTF]] public.font = [[Fonts\ARIALN.TTF]]
public.font_size = { public.font_size = {
@@ -23,7 +97,6 @@ end
do do
local menu, structure, orig local menu, structure, orig
menu = CreateFrame('Frame', name, UIParent, 'UIMenuTemplate') menu = CreateFrame('Frame', name, UIParent, 'UIMenuTemplate')
hook('OnShow', menu)
orig = menu:GetScript 'OnShow' orig = menu:GetScript 'OnShow'
menu:SetScript('OnShow', function() menu:SetScript('OnShow', function()
UIMenu_Initialize() UIMenu_Initialize()
@@ -43,78 +116,6 @@ do
end end
end end
do
local blizzard_backdrop, aux_background, aux_border
aux_border = DropDownList1:CreateTexture()
aux_border:SetTexture(1, 1, 1, .02)
aux_border:SetPoint('TOPLEFT', DropDownList1Backdrop, 'TOPLEFT', -2, 2)
aux_border:SetPoint('BOTTOMRIGHT', DropDownList1Backdrop, 'BOTTOMRIGHT', 1.5, -1.5)
aux_border:SetBlendMode 'ADD'
aux_background = DropDownList1:CreateTexture(nil, 'OVERLAY')
aux_background:SetTexture(color.content.background())
aux_background:SetAllPoints(DropDownList1Backdrop)
blizzard_backdrop = DropDownList1Backdrop:GetBackdrop()
hook('ToggleDropDownMenu', function(...)
local ret = {orig.ToggleDropDownMenu(unpack(arg))}
local dropdown = _g[arg[4] or ''] or this:GetParent()
if strfind(dropdown:GetName() or '', '^aux_frame%d+$') then
set_aux_dropdown_style(dropdown)
else
set_blizzard_dropdown_style()
end
return unpack(ret)
end)
function set_aux_dropdown_style(dropdown)
DropDownList1Backdrop:SetBackdrop{}
aux_border:Show()
aux_background:Show()
DropDownList1:SetWidth(dropdown:GetWidth() * 0.9)
DropDownList1:SetHeight(DropDownList1:GetHeight() - 10)
DropDownList1:ClearAllPoints()
DropDownList1:SetPoint('TOPLEFT', dropdown, 'BOTTOMLEFT', -2, -2)
for i=1,UIDROPDOWNMENU_MAXBUTTONS do
local button = _g['DropDownList1Button'..i]
button:SetPoint('TOPLEFT', 0, -((button:GetID() - 1) * UIDROPDOWNMENU_BUTTON_HEIGHT) - 7)
button:SetPoint('TOPRIGHT', 0, -((button:GetID() - 1) * UIDROPDOWNMENU_BUTTON_HEIGHT) - 7)
local text = button:GetFontString()
text:SetFont(font, font_size.small2)
text:SetPoint('TOPLEFT', 18, 0)
text:SetPoint('BOTTOMRIGHT', -8, 0)
local highlight = _g['DropDownList1Button'..i..'Highlight']
highlight:ClearAllPoints()
highlight:SetDrawLayer 'OVERLAY'
highlight:SetHeight(14)
highlight:SetPoint('LEFT', 5, 0)
highlight:SetPoint('RIGHT', -3, 0)
local check = _g['DropDownList1Button'..i..'Check']
check:SetWidth(16)
check:SetHeight(16)
check:SetPoint('LEFT', 3, -1)
end
end
function set_blizzard_dropdown_style()
DropDownList1Backdrop:SetBackdrop(blizzard_backdrop)
aux_border:Hide()
aux_background:Hide()
for i=1,UIDROPDOWNMENU_MAXBUTTONS do
local button = _g['DropDownList1Button'..i]
local text = button:GetFontString()
text:SetFont([[Fonts\FRIZQT__.ttf]], 10)
text:SetShadowOffset(1, -1)
local highlight = _g['DropDownList1Button'..i..'Highlight']
highlight:SetAllPoints()
highlight:SetDrawLayer 'BACKGROUND'
local check = _g['DropDownList1Button'..i..'Check']
check:SetWidth(24)
check:SetHeight(24)
check:SetPoint('LEFT', 0, 0)
end
end
end
function public.set_size(frame, width, height) function public.set_size(frame, width, height)
frame:SetWidth(width) frame:SetWidth(width)
frame:SetHeight(height or width) frame:SetHeight(height or width)
+1 -1
View File
@@ -1,4 +1,4 @@
module 'item_listing' module 'item_listing' import 'gui'
local ROW_HEIGHT = 39 local ROW_HEIGHT = 39
+1 -1
View File
@@ -1,4 +1,4 @@
module 'listing' module 'listing' import 'gui'
local ST_COUNT = 0 local ST_COUNT = 0
+2 -1
View File
@@ -42,11 +42,12 @@ do
local state, modifier = _state[self], MODIFIER[key]; local modifiers = state.modifiers local state, modifier = _state[self], MODIFIER[key]; local modifiers = state.modifiers
if modifier then if modifier then
if mask(MODIFIER_MASK[key], modifiers) ~= modifiers then modifier_error() end if mask(MODIFIER_MASK[key], modifiers) ~= modifiers then modifier_error() end
state.modifiers = modifiers + modifier; return self state.modifiers = modifiers + modifier
elseif not state.metadata[key] or collision_error(key) then elseif not state.metadata[key] or collision_error(key) then
if mask(PROPERTY_MASK, modifiers) ~= modifiers then modifier_error() end if mask(PROPERTY_MASK, modifiers) ~= modifiers then modifier_error() end
state.property, state.metadata[key], state.modifiers = key, modifiers + PROPERTY, PRIVATE state.property, state.metadata[key], state.modifiers = key, modifiers + PROPERTY, PRIVATE
end end
return self
end end
end end
function declarator_mt.__newindex(self, key, value) function declarator_mt.__newindex(self, key, value)
-1
View File
@@ -1,5 +1,4 @@
module 'auctions_tab' module 'auctions_tab'
tab(3, 'Auctions')
auction_records = nil auction_records = nil
+4 -4
View File
@@ -1,4 +1,4 @@
module 'auctions_tab' import 'gui' module 'auctions_tab' import 'gui' 'auction_listing'
function create_frames() function create_frames()
frame = CreateFrame('Frame', nil, aux_frame) frame = CreateFrame('Frame', nil, aux_frame)
@@ -8,8 +8,8 @@ function create_frames()
frame.listing = gui.panel(frame) frame.listing = gui.panel(frame)
frame.listing:SetPoint('TOP', frame, 'TOP', 0, -8) frame.listing:SetPoint('TOP', frame, 'TOP', 0, -8)
frame.listing:SetPoint('BOTTOMLEFT', frame.content, 'BOTTOMLEFT', 0, 0) frame.listing:SetPoint('BOTTOMLEFT', aux_frame.content, 'BOTTOMLEFT', 0, 0)
frame.listing:SetPoint('BOTTOMRIGHT', frame.content, 'BOTTOMRIGHT', 0, 0) frame.listing:SetPoint('BOTTOMRIGHT', aux_frame.content, 'BOTTOMRIGHT', 0, 0)
listing = auction_listing.CreateAuctionResultsTable(frame.listing, auction_listing.auctions_config) listing = auction_listing.CreateAuctionResultsTable(frame.listing, auction_listing.auctions_config)
listing:SetSort(1,2,3,4,5,6,7,8) listing:SetSort(1,2,3,4,5,6,7,8)
@@ -28,7 +28,7 @@ function create_frames()
status_bar = gui.status_bar(frame) status_bar = gui.status_bar(frame)
status_bar:SetWidth(265) status_bar:SetWidth(265)
status_bar:SetHeight(25) status_bar:SetHeight(25)
status_bar:SetPoint('TOPLEFT', frame.content, 'BOTTOMLEFT', 0, -6) status_bar:SetPoint('TOPLEFT', aux_frame.content, 'BOTTOMLEFT', 0, -6)
status_bar:update_status(100, 100) status_bar:update_status(100, 100)
status_bar:set_text('') status_bar:set_text('')
end end
-1
View File
@@ -1,5 +1,4 @@
module 'bids_tab' module 'bids_tab'
tab(4, 'Bids')
auction_records = nil auction_records = nil
+4 -4
View File
@@ -1,4 +1,4 @@
module 'bids_tab' import 'gui' module 'bids_tab' import 'gui' 'auction_listing'
function create_frames() function create_frames()
frame = CreateFrame('Frame', nil, aux_frame) frame = CreateFrame('Frame', nil, aux_frame)
@@ -8,8 +8,8 @@ function create_frames()
frame.listing = gui.panel(frame) frame.listing = gui.panel(frame)
frame.listing:SetPoint('TOP', frame, 'TOP', 0, -8) frame.listing:SetPoint('TOP', frame, 'TOP', 0, -8)
frame.listing:SetPoint('BOTTOMLEFT', frame.content, 'BOTTOMLEFT', 0, 0) frame.listing:SetPoint('BOTTOMLEFT', aux_frame.content, 'BOTTOMLEFT', 0, 0)
frame.listing:SetPoint('BOTTOMRIGHT', frame.content, 'BOTTOMRIGHT', 0, 0) frame.listing:SetPoint('BOTTOMRIGHT', aux_frame.content, 'BOTTOMRIGHT', 0, 0)
listing = auction_listing.CreateAuctionResultsTable(frame.listing, auction_listing.bids_config) listing = auction_listing.CreateAuctionResultsTable(frame.listing, auction_listing.bids_config)
listing:SetSort(1,2,3,4,5,6,7,8) listing:SetSort(1,2,3,4,5,6,7,8)
@@ -32,7 +32,7 @@ function create_frames()
status_bar = gui.status_bar(frame) status_bar = gui.status_bar(frame)
status_bar:SetWidth(265) status_bar:SetWidth(265)
status_bar:SetHeight(25) status_bar:SetHeight(25)
status_bar:SetPoint('TOPLEFT', frame.content, 'BOTTOMLEFT', 0, -6) status_bar:SetPoint('TOPLEFT', aux_frame.content, 'BOTTOMLEFT', 0, -6)
status_bar:update_status(100, 0) status_bar:update_status(100, 0)
status_bar:set_text('') status_bar:set_text('')
end end
-1
View File
@@ -1,5 +1,4 @@
module 'post_tab' module 'post_tab'
tab(2, 'Post')
local DURATION_4, DURATION_8, DURATION_24 = 120, 480, 1440 local DURATION_4, DURATION_8, DURATION_24 = 120, 480, 1440
local settings_schema = {'record', '#', {stack_size='number'}, {duration='number'}, {start_price='number'}, {buyout_price='number'}, {hidden='boolean'}} local settings_schema = {'record', '#', {stack_size='number'}, {duration='number'}, {start_price='number'}, {buyout_price='number'}, {hidden='boolean'}}
+7 -7
View File
@@ -1,4 +1,4 @@
module 'post_tab' import 'gui' module 'post_tab' import [''] 'core' 'gui' 'listing' 'item_listing' 'money'
function create_frames() function create_frames()
frame = CreateFrame('Frame', nil, aux_frame) frame = CreateFrame('Frame', nil, aux_frame)
@@ -8,20 +8,20 @@ function create_frames()
frame.content = CreateFrame('Frame', nil, frame) frame.content = CreateFrame('Frame', nil, frame)
frame.content:SetPoint('TOP', frame, 'TOP', 0, -8) frame.content:SetPoint('TOP', frame, 'TOP', 0, -8)
frame.content:SetPoint('BOTTOMLEFT', frame.content, 'BOTTOMLEFT', 0, 0) frame.content:SetPoint('BOTTOMLEFT', aux_frame.content, 'BOTTOMLEFT', 0, 0)
frame.content:SetPoint('BOTTOMRIGHT', frame.content, 'BOTTOMRIGHT', 0, 0) frame.content:SetPoint('BOTTOMRIGHT', aux_frame.content, 'BOTTOMRIGHT', 0, 0)
frame.inventory = gui.panel(frame.content) frame.inventory = gui.panel(aux_frame.content)
frame.inventory:SetWidth(212) frame.inventory:SetWidth(212)
frame.inventory:SetPoint('TOPLEFT', 0, 0) frame.inventory:SetPoint('TOPLEFT', 0, 0)
frame.inventory:SetPoint('BOTTOMLEFT', 0, 0) frame.inventory:SetPoint('BOTTOMLEFT', 0, 0)
frame.parameters = gui.panel(frame.content) frame.parameters = gui.panel(aux_frame.content)
frame.parameters:SetHeight(173) frame.parameters:SetHeight(173)
frame.parameters:SetPoint('TOPLEFT', frame.inventory, 'TOPRIGHT', 2.5, 0) frame.parameters:SetPoint('TOPLEFT', frame.inventory, 'TOPRIGHT', 2.5, 0)
frame.parameters:SetPoint('TOPRIGHT', 0, 0) frame.parameters:SetPoint('TOPRIGHT', 0, 0)
frame.auctions = gui.panel(frame.content) frame.auctions = gui.panel(aux_frame.content)
frame.auctions:SetHeight(228) frame.auctions:SetHeight(228)
frame.auctions:SetPoint('BOTTOMLEFT', frame.inventory, 'BOTTOMRIGHT', 2.5, 0) frame.auctions:SetPoint('BOTTOMLEFT', frame.inventory, 'BOTTOMRIGHT', 2.5, 0)
frame.auctions:SetPoint('BOTTOMRIGHT', 0, 0) frame.auctions:SetPoint('BOTTOMRIGHT', 0, 0)
@@ -84,7 +84,7 @@ function create_frames()
status_bar = gui.status_bar(frame) status_bar = gui.status_bar(frame)
status_bar:SetWidth(265) status_bar:SetWidth(265)
status_bar:SetHeight(25) status_bar:SetHeight(25)
status_bar:SetPoint('TOPLEFT', frame.content, 'BOTTOMLEFT', 0, -6) status_bar:SetPoint('TOPLEFT', aux_frame.content, 'BOTTOMLEFT', 0, -6)
status_bar:update_status(100, 100) status_bar:update_status(100, 100)
status_bar:set_text('') status_bar:set_text('')
end end
-1
View File
@@ -1,5 +1,4 @@
module 'search_tab' module 'search_tab'
tab(1, 'Search')
StaticPopupDialogs['AUX_SEARCH_TABLE_FULL'] = { StaticPopupDialogs['AUX_SEARCH_TABLE_FULL'] = {
text = 'Table full!\nFurther results from this search will still be processed but no longer displayed in the table.', text = 'Table full!\nFurther results from this search will still be processed but no longer displayed in the table.',
+6 -6
View File
@@ -1,4 +1,4 @@
module 'search_tab' import 'gui' module 'search_tab' import 'gui' [''] 'core' 'completion' 'listing' 'auction_listing'
FILTER_SPACING = 28.5 FILTER_SPACING = 28.5
@@ -9,13 +9,13 @@ function create_frames()
frame:Hide() frame:Hide()
frame.filter = gui.panel(frame) frame.filter = gui.panel(frame)
frame.filter:SetAllPoints(frame.content) frame.filter:SetAllPoints(aux_frame.content)
frame.results = gui.panel(frame) frame.results = gui.panel(frame)
frame.results:SetAllPoints(frame.content) frame.results:SetAllPoints(aux_frame.content)
frame.saved = CreateFrame('Frame', nil, frame) frame.saved = CreateFrame('Frame', nil, frame)
frame.saved:SetAllPoints(frame.content) frame.saved:SetAllPoints(aux_frame.content)
frame.saved.favorite = gui.panel(frame.saved) frame.saved.favorite = gui.panel(frame.saved)
frame.saved.favorite:SetWidth(378.5) frame.saved.favorite:SetWidth(378.5)
@@ -243,7 +243,7 @@ function create_frames()
end end
do do
local btn = gui.button(frame, gui.font_size.large2) local btn = gui.button(frame, gui.font_size.large2)
btn:SetPoint('BOTTOMLEFT', frame.content, 'TOPLEFT', 10, 8) btn:SetPoint('BOTTOMLEFT', aux_frame.content, 'TOPLEFT', 10, 8)
btn:SetWidth(243) btn:SetWidth(243)
btn:SetHeight(22) btn:SetHeight(22)
btn:SetText 'Search Results' btn:SetText 'Search Results'
@@ -272,7 +272,7 @@ function create_frames()
local frame = CreateFrame('Frame', nil, frame) local frame = CreateFrame('Frame', nil, frame)
frame:SetWidth(265) frame:SetWidth(265)
frame:SetHeight(25) frame:SetHeight(25)
frame:SetPoint('TOPLEFT', frame.content, 'BOTTOMLEFT', 0, -6) frame:SetPoint('TOPLEFT', aux_frame.content, 'BOTTOMLEFT', 0, -6)
status_bar_frame = frame status_bar_frame = frame
end end
do do
+13 -13
View File
@@ -116,9 +116,9 @@ function update_auto_buy_filter()
local queries = filter.queries(_g.aux_auto_buy_filter) local queries = filter.queries(_g.aux_auto_buy_filter)
if queries then if queries then
if getn(queries) > 1 then if getn(queries) > 1 then
log('Error: The automatic buyout filter may contain only one query') log 'Error: The automatic buyout filter does not support multi-queries'
elseif size(queries[1].blizzard_query) > 0 then elseif size(queries[1].blizzard_query) > 0 then
log('Error: The automatic buyout filter does not support Blizzard filters') log 'Error: The automatic buyout filter does not support Blizzard filters'
else else
auto_buy_validator = queries[1].validator auto_buy_validator = queries[1].validator
auto_buy_filter_button.prettified = queries[1].prettified auto_buy_filter_button.prettified = queries[1].prettified
@@ -168,20 +168,20 @@ function start_real_time_scan(query, search, continuation)
end end
end, end,
on_complete = function() on_complete = function()
local map = {} local map = tt
for _, record in search.records do for _, record in search.records do
map[record.sniping_signature] = record map[record.sniping_signature] = record
end end
for _, record in new_records do for _, record in new_records do
map[record.sniping_signature] = record map[record.sniping_signature] = record
end end
new_records = {} new_records = t
for _, record in map do for _, record in map do
tinsert(new_records, record) tinsert(new_records, record)
end end
if getn(new_records) > 1000 then if getn(new_records) > 1000 then
StaticPopup_Show('AUX_SEARCH_TABLE_FULL') StaticPopup_Show 'AUX_SEARCH_TABLE_FULL'
else else
search.records = new_records search.records = new_records
search.table:SetDatabase(search.records) search.table:SetDatabase(search.records)
@@ -193,7 +193,7 @@ function start_real_time_scan(query, search, continuation)
end, end,
on_abort = function() on_abort = function()
search.status_bar:update_status(100, 100) search.status_bar:update_status(100, 100)
search.status_bar:set_text('Scan paused') search.status_bar:set_text 'Scan paused'
search.continuation = next_page or not ignore_page and query.blizzard_query.first_page or true search.continuation = next_page or not ignore_page and query.blizzard_query.first_page or true
@@ -233,9 +233,9 @@ function start_search(queries, continuation)
on_scan_start = function() on_scan_start = function()
search.status_bar:update_status(0,0) search.status_bar:update_status(0,0)
if continuation then if continuation then
search.status_bar:set_text('Resuming scan...') search.status_bar:set_text 'Resuming scan...'
else else
search.status_bar:set_text('Scanning auctions...') search.status_bar:set_text 'Scanning auctions...'
end end
end, end,
on_page_loaded = function(_, total_scan_pages) on_page_loaded = function(_, total_scan_pages)
@@ -261,13 +261,13 @@ function start_search(queries, continuation)
elseif getn(search.records) < 1000 then elseif getn(search.records) < 1000 then
tinsert(search.records, auction_record) tinsert(search.records, auction_record)
if getn(search.records) == 1000 then if getn(search.records) == 1000 then
StaticPopup_Show('AUX_SEARCH_TABLE_FULL') StaticPopup_Show 'AUX_SEARCH_TABLE_FULL'
end end
end end
end, end,
on_complete = function() on_complete = function()
search.status_bar:update_status(100, 100) search.status_bar:update_status(100, 100)
search.status_bar:set_text('Scan complete') search.status_bar:set_text 'Scan complete'
if current_search == search and frame.results:IsVisible() and getn(search.records) == 0 then if current_search == search and frame.results:IsVisible() and getn(search.records) == 0 then
set_tab(SAVED) set_tab(SAVED)
@@ -278,7 +278,7 @@ function start_search(queries, continuation)
end, end,
on_abort = function() on_abort = function()
search.status_bar:update_status(100, 100) search.status_bar:update_status(100, 100)
search.status_bar:set_text('Scan paused') search.status_bar:set_text 'Scan paused'
if current_query then if current_query then
search.continuation = {current_query, current_page + 1} search.continuation = {current_query, current_page + 1}
@@ -313,10 +313,10 @@ function public.execute(resume, real_time)
return return
elseif real_time then elseif real_time then
if getn(queries) > 1 then if getn(queries) > 1 then
log('Invalid filter: The real time mode does not support multiple queries') log 'Error: The real time mode does not support multi-queries'
return return
elseif queries[1].blizzard_query.first_page or queries[1].blizzard_query.last_page then elseif queries[1].blizzard_query.first_page or queries[1].blizzard_query.last_page then
log('Invalid filter: The real time mode does not support page range filters') log 'Error: The real time mode does not support page ranges'
return return
end end
end end
+1 -1
View File
@@ -1,4 +1,4 @@
module 'util' module 'core'
COLORS = { COLORS = {
text = {enabled = {255, 254, 250, 1}, disabled = {147, 151, 139, 1}}, text = {enabled = {255, 254, 250, 1}, disabled = {147, 151, 139, 1}},
+23 -28
View File
@@ -1,28 +1,11 @@
module 'util' module 'core'
public.join = _g.join public.join = _g.table.concat
function public.replicate(count, value) function public.replicate(count, value)
if count > 0 then return value, replicate(count - 1, value) end if count > 0 then return value, replicate(count - 1, value) end
end end
do
local value, charges
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')}] = mutator(i) end
function public.accessor.__()
assert(charges > 0)
charges = charges - 1
return value
end
end
do do
local state local state
local function f() local function f()
@@ -67,14 +50,12 @@ do
end end
end end
function public.call(f, ...) function public.call(f, ...) temp=arg
temp(arg)
if f then return f(unpack(arg)) end if f then return f(unpack(arg)) end
end end
function public.index(t, ...) function public.index(t, ...) temp=arg
for i=1,arg.n do t = t and t[arg[i]] end for i=1,arg.n do t = t and t[arg[i]] end
recycle(arg)
return t return t
end end
@@ -106,10 +87,9 @@ do
end end
end end
function public.expand(array, ...) function public.expand(array, ...) temp=arg
local t = t local t = t
for i=1,arg.n do t[arg[i]] = array[i] end for i=1,arg.n do t[arg[i]] = array[i] end
recycle(arg)
return t return t
end end
@@ -120,10 +100,25 @@ function public.copy(t)
return setmetatable(copy, getmetatable(t)) return setmetatable(copy, getmetatable(t))
end end
function public.select(i, ...) function public.select(i, ...) temp=arg
temp(arg)
while i > 1 do i = i - 1; tremove(arg, i) end while i > 1 do i = i - 1; tremove(arg, i) end
return tremove(arg, 1), unpack(temp) return tremove(arg, 1), unpack(arg)
end
function public.collect(t, ...) temp=arg
local T = T
for _, v in t do
tinsert(T, arg[v])
end
return T
end
function public.hashset(t)
local set = _m.t
for _, v in t do
set[v] = true
end
return set
end end
function public.size(t) function public.size(t)
+10 -7
View File
@@ -285,10 +285,11 @@ function public.parse_query_string(str)
local i = 1 local i = 1
while parts[i] do while parts[i] do
if x(operator(parts[i])) then local operator = operator(parts[i])
tinsert(post_filter, __) if operator then
elseif x(filters[parts[i]]) then tinsert(post_filter, operator)
local input_type = __.input_type elseif filters[parts[i]] then
local input_type = filters[parts[i]].input_type
if input_type ~= '' then if input_type ~= '' then
if not parts[i + 1] or not parse_parameter(input_type, parts[i + 1]) then if not parts[i + 1] or not parse_parameter(input_type, parts[i + 1]) then
if parts[i] == 'item' then if parts[i] == 'item' then
@@ -494,8 +495,10 @@ function blizzard_query(components)
local query = {name=filters.name and filters.name[2]} local query = {name=filters.name and filters.name[2]}
local item_info, class_index, subclass_index, slot_index local item_info, class_index, subclass_index, slot_index
if filters.exact and x(cache.item_id(filters.name[2])) and x(info.item(__)) then local item_id = cache.item_id(filters.name[2])
item_info = __ item_info = item_id and info.item(item_id)
if filters.exact and item_info then
item_info = info.item(item_id)
class_index = info.item_class_index(item_info.class) class_index = info.item_class_index(item_info.class)
subclass_index = info.item_subclass_index(class_index or 0, item_info.subclass) subclass_index = info.item_subclass_index(class_index or 0, item_info.subclass)
slot_index = info.item_slot_index(class_index or 0, subclass_index or 0, item_info.slot) slot_index = info.item_slot_index(class_index or 0, subclass_index or 0, item_info.slot)
@@ -510,7 +513,7 @@ function blizzard_query(components)
query.slot = slot_index query.slot = slot_index
query.quality = item_info.quality query.quality = item_info.quality
else else
for _, key in {'min_level', 'max_level', 'class', 'subclass', 'slot', 'usable', 'quality'} do for key in set 'min_level' 'max_level' 'class' 'subclass' 'slot' 'usable' 'quality' do
query[key] = index(filters[key], 2) query[key] = index(filters[key], 2)
end end
end end
+2 -2
View File
@@ -176,7 +176,7 @@ end
function public.set_shopping_tooltip(slot) function public.set_shopping_tooltip(slot)
local index1, index2 = inventory_index(slot) local index1, index2 = inventory_index(slot)
local tooltips = {} local tooltips = tt
if index1 then if index1 then
local tooltip = tooltip(function(tt) tt:SetInventoryItem('player', index1) end) local tooltip = tooltip(function(tt) tt:SetInventoryItem('player', index1) end)
if getn(tooltip) > 0 then if getn(tooltip) > 0 then
@@ -273,7 +273,7 @@ function public.tooltip(mutator)
mutator(AuxTooltip) mutator(AuxTooltip)
AuxTooltip:Show() AuxTooltip:Show()
local tooltip = {} local tooltip = t
for i=1,AuxTooltip:NumLines() do for i=1,AuxTooltip:NumLines() do
tinsert(tooltip, { tinsert(tooltip, {
left_text = _g['AuxTooltipTextLeft'..i]:GetText(), left_text = _g['AuxTooltipTextLeft'..i]:GetText(),
+4 -3
View File
@@ -80,7 +80,7 @@ function public.to_string(money, pad, trim, decimal_points, color, no_color)
local text local text
if trim then if trim then
local parts = {} local parts = tt
if gold > 0 then if gold > 0 then
tinsert(parts, format_number(gold, false, nil, color)..gold_text) tinsert(parts, format_number(gold, false, nil, color)..gold_text)
end end
@@ -113,8 +113,9 @@ function public.to_string(money, pad, trim, decimal_points, color, no_color)
end end
function public.from_string(value) function public.from_string(value)
if xx(tonumber(value)) and __ >= 0 then local number = tonumber(value)
return __ * COPPER_PER_GOLD if number and number >= 0 then
return number * COPPER_PER_GOLD
end end
-- remove any colors -- remove any colors
+5 -6
View File
@@ -1,6 +1,6 @@
module 'persistence' module 'persistence'
_g.aux_datasets = {} _g.aux_datasets = t
do do
local realm, faction local realm, faction
@@ -15,7 +15,7 @@ end
function public.load_dataset() function public.load_dataset()
local dataset_key = dataset_key local dataset_key = dataset_key
_g.aux_datasets[dataset_key] = _g.aux_datasets[dataset_key] or {} _g.aux_datasets[dataset_key] = _g.aux_datasets[dataset_key] or t
return _g.aux_datasets[dataset_key] return _g.aux_datasets[dataset_key]
end end
@@ -64,8 +64,7 @@ function public.write(schema, obj)
end end
function public.read_list(schema, str) function public.read_list(schema, str)
if str == '' then return {} end if str == '' then return t end
local separator = schema[2] local separator = schema[2]
local element_type = schema[3] local element_type = schema[3]
local parts = split(str, separator) local parts = split(str, separator)
@@ -85,7 +84,7 @@ end
function public.read_record(schema, str) function public.read_record(schema, str)
local separator = schema[2] local separator = schema[2]
local record = {} local record = t
local parts = split(str, separator) local parts = split(str, separator)
for i=3,getn(schema) do for i=3,getn(schema) do
local key, type = next(schema[i]) local key, type = next(schema[i])
@@ -96,7 +95,7 @@ end
function public.write_record(schema, record) function public.write_record(schema, record)
local separator = schema[2] local separator = schema[2]
local parts = {} local parts = tt
for i=3,getn(schema) do for i=3,getn(schema) do
local key, type = next(schema[i]) local key, type = next(schema[i])
tinsert(parts, write(type, record[key])) tinsert(parts, write(type, record[key]))
+2 -2
View File
@@ -7,8 +7,8 @@ function public.find(auction_record, status_bar, on_abort, on_failure, on_succes
return auction_info and auction_info.search_signature == auction_record.search_signature return auction_info and auction_info.search_signature == auction_record.search_signature
end end
local queries = {} local queries = t
tinsert(queries, {}) tinsert(queries, t)
if auction_record.blizzard_query then if auction_record.blizzard_query then
+5 -5
View File
@@ -1,10 +1,10 @@
module 'sorting' module 'sorting'
public.LT = {} public()
public.EQ = {}
public.GT = {}
function public.compare(a, b, desc) LT, EQ, GT = t, t, t
function compare(a, b, desc)
if a < b then if a < b then
return desc and GT or LT return desc and GT or LT
elseif a > b then elseif a > b then
@@ -14,7 +14,7 @@ function public.compare(a, b, desc)
end end
end end
function public.multi_lt(xs, ys) function multi_lt(xs, ys)
local i = 1 local i = 1
while true do while true do
if xs[i] and ys[i] and xs[i] ~= ys[i] then if xs[i] and ys[i] and xs[i] ~= ys[i] then