big refactoring
This commit is contained in:
@@ -1,13 +1,11 @@
|
||||
module 'core'
|
||||
|
||||
function INIT()
|
||||
import :_ 'core' :_ 'util'
|
||||
import :_ 'aux' :_ 'util'
|
||||
function LOAD()
|
||||
import :_ 'core' :_ 'control' :_ 'util'
|
||||
import :_ 'aux' :_ 'util'
|
||||
end
|
||||
end
|
||||
|
||||
module 'core'
|
||||
module 'aux'
|
||||
public.version = '5.0.0'
|
||||
|
||||
do
|
||||
+19
-20
@@ -4,12 +4,11 @@
|
||||
## SavedVariables: aux_datasets, aux_items, aux_item_ids, aux_auctionable_items, aux_merchant_buy, aux_merchant_sell, aux_characters, aux_recent_searches, aux_favorite_searches, aux_ignore_owner, aux_price_per_unit
|
||||
|
||||
module.lua
|
||||
init.lua
|
||||
core.lua
|
||||
util.lua
|
||||
aux-addon.lua
|
||||
util\core.lua
|
||||
control.lua
|
||||
gui.lua
|
||||
frames.lua
|
||||
gui\core.lua
|
||||
frame.lua
|
||||
|
||||
|
||||
util\completion.lua
|
||||
@@ -21,34 +20,34 @@ util\filter.lua
|
||||
util\scan_util.lua
|
||||
|
||||
|
||||
components\cache.lua
|
||||
components\disenchant.lua
|
||||
components\slash.lua
|
||||
components\scan.lua
|
||||
components\stack.lua
|
||||
components\post.lua
|
||||
components\history.lua
|
||||
components\tooltip.lua
|
||||
core\cache.lua
|
||||
core\disenchant.lua
|
||||
core\slash.lua
|
||||
core\scan.lua
|
||||
core\stack.lua
|
||||
core\post.lua
|
||||
core\history.lua
|
||||
core\tooltip.lua
|
||||
|
||||
|
||||
tables\listing.lua
|
||||
tables\auction_listing.lua
|
||||
tables\item_listing.lua
|
||||
gui\listing.lua
|
||||
gui\auction_listing.lua
|
||||
gui\item_listing.lua
|
||||
|
||||
|
||||
tabs\search\core.lua
|
||||
tabs\search\results.lua
|
||||
tabs\search\saved.lua
|
||||
tabs\search\filter.lua
|
||||
tabs\search\frames.lua
|
||||
tabs\search\frame.lua
|
||||
|
||||
tabs\post\core.lua
|
||||
tabs\post\frames.lua
|
||||
tabs\post\frame.lua
|
||||
|
||||
tabs\auctions\core.lua
|
||||
tabs\auctions\frames.lua
|
||||
tabs\auctions\frame.lua
|
||||
|
||||
tabs\bids\core.lua
|
||||
tabs\bids\frames.lua
|
||||
tabs\bids\frame.lua
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
module 'core'
|
||||
module 'aux'
|
||||
|
||||
event_frame = CreateFrame 'Frame'
|
||||
listeners = {}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
module 'core'
|
||||
module 'aux'
|
||||
|
||||
public.bids_loaded = false
|
||||
public.current_owner_page = nil
|
||||
@@ -1,120 +0,0 @@
|
||||
function INIT()
|
||||
import :_ 'core' :_ 'util'
|
||||
function LOAD()
|
||||
import :_ 'core' :_ 'control' :_ 'util'
|
||||
end
|
||||
end
|
||||
|
||||
module 'core'
|
||||
public.version = '5.0.0'
|
||||
|
||||
do
|
||||
local table_pool, temporary = {}, {}
|
||||
|
||||
CreateFrame'Frame':SetScript('OnUpdate', function()
|
||||
for t in temporary do
|
||||
recycle(t)
|
||||
log(getn(table_pool))
|
||||
end
|
||||
wipe(temporary)
|
||||
end)
|
||||
|
||||
function public.wipe(t) -- like with a cloth or something
|
||||
for k in t do
|
||||
t[k] = nil
|
||||
end
|
||||
table.setn(t, 0)
|
||||
end
|
||||
|
||||
function public.recycle(t)
|
||||
temporary[t] = nil
|
||||
wipe(t)
|
||||
tinsert(table_pool, t)
|
||||
end
|
||||
|
||||
function public.accessor.t() return
|
||||
tremove(table_pool) or {}
|
||||
end
|
||||
|
||||
function public.accessor.tt()
|
||||
local t = tremove(table_pool) or {}
|
||||
temporary[t] = true
|
||||
return t
|
||||
end
|
||||
|
||||
do
|
||||
local mt = {
|
||||
__call=function(self, arg) return self[1](arg) end,
|
||||
__sub=function(self, arg) return self[1](arg) end,
|
||||
}
|
||||
function public.modifier(f)
|
||||
local self = t
|
||||
self[1] = f
|
||||
return setmetatable(self, mt)
|
||||
end
|
||||
end
|
||||
|
||||
public.tmp = modifier(function(t)
|
||||
temporary[t] = true
|
||||
return t
|
||||
end)
|
||||
|
||||
do
|
||||
local mt = {
|
||||
__call=function(self, arg1, arg2)
|
||||
tinsert(self, arg2 or arg1)
|
||||
return self
|
||||
end,
|
||||
__index=function(self, key)
|
||||
tinsert(self, key)
|
||||
return self
|
||||
end,
|
||||
}
|
||||
function public.accessor.from()
|
||||
return setmetatable(tt, mt)
|
||||
end
|
||||
end
|
||||
|
||||
do
|
||||
local mt = {__call = function(self, key) return self[key] end}
|
||||
public.set = modifier(function(table)
|
||||
local self = t
|
||||
for _, v in table do self[v] = true end
|
||||
recycle(table)
|
||||
return setmetatable(self, mt)
|
||||
end)
|
||||
end
|
||||
|
||||
public.array = modifier(function(table)
|
||||
local self = t
|
||||
for _, v in table do tinsert(self, v) end
|
||||
recycle(table)
|
||||
return self
|
||||
end)
|
||||
|
||||
-- TODO map
|
||||
end
|
||||
|
||||
local event_frame = CreateFrame 'Frame'
|
||||
for event in tmp-set-from . ADDON_LOADED . VARIABLES_LOADED . PLAYER_LOGIN . AUCTION_HOUSE_SHOW . AUCTION_HOUSE_CLOSED . AUCTION_BIDDER_LIST_UPDATE . AUCTION_OWNED_LIST_UPDATE do
|
||||
event_frame:RegisterEvent(event)
|
||||
end
|
||||
|
||||
ADDON_LOADED = t
|
||||
do
|
||||
local variables_loaded_hooks, player_login_hooks = t, t
|
||||
function public.mutator.LOAD(f) tinsert(variables_loaded_hooks, f) end
|
||||
function public.mutator.LOAD2(f) tinsert(player_login_hooks, f) end
|
||||
event_frame:SetScript('OnEvent', function()
|
||||
if event == 'ADDON_LOADED' then
|
||||
if ADDON_LOADED[arg1] then ADDON_LOADED[arg1]() end
|
||||
elseif event == 'VARIABLES_LOADED' then
|
||||
for _, f in variables_loaded_hooks do f() end
|
||||
elseif event == 'PLAYER_LOGIN' then
|
||||
for _, f in player_login_hooks do f() end
|
||||
log('v'..version..' loaded.')
|
||||
else
|
||||
_m[event]()
|
||||
end
|
||||
end)
|
||||
end
|
||||
Reference in New Issue
Block a user