refactoring
This commit is contained in:
+13
-14
@@ -77,7 +77,7 @@ do
|
||||
public.temp
|
||||
{
|
||||
get = function() return setmetatable(t, mt) end,
|
||||
set = function(t) return make_transient(t) end,
|
||||
set = function(t) make_transient(t) end,
|
||||
}
|
||||
end
|
||||
do
|
||||
@@ -85,7 +85,7 @@ do
|
||||
public.perm
|
||||
{
|
||||
get = function() return setmetatable(t, mt) end,
|
||||
set = function(t) return make_persistent(t) end,
|
||||
set = function(t) make_persistent(t) end,
|
||||
}
|
||||
end
|
||||
|
||||
@@ -155,15 +155,20 @@ do
|
||||
return {__call=f, __unm=function(self) return setmetatable(self, nil) end}
|
||||
end
|
||||
local set_mt, list_mt, object_mt = collector_mt(insert_keys), collector_mt(insert_values), collector_mt(insert_pairs)
|
||||
public()
|
||||
function list() return setmetatable(t, list_mt) end
|
||||
function set() return setmetatable(t, set_mt) end
|
||||
function object() return setmetatable(t, object_mt) end
|
||||
private()
|
||||
function public.set.get() return setmetatable(t, set_mt) end
|
||||
function public.list.get() return setmetatable(t, list_mt) end
|
||||
function public.object.get() return setmetatable(t, object_mt) end
|
||||
end
|
||||
|
||||
function public.log(...) temp=arg
|
||||
local msg = '[aux]'
|
||||
for i=1,arg.n do msg = msg..' '..tostring(arg[i]) end
|
||||
DEFAULT_CHAT_FRAME:AddMessage(LIGHTYELLOW_FONT_COLOR_CODE..msg)
|
||||
end
|
||||
|
||||
local event_frame = CreateFrame 'Frame'
|
||||
for event in -temp-set('ADDON_LOADED', 'VARIABLES_LOADED', 'PLAYER_LOGIN', 'AUCTION_HOUSE_SHOW', 'AUCTION_HOUSE_CLOSED', 'AUCTION_BIDDER_LIST_UPDATE', 'AUCTION_OWNED_LIST_UPDATE') do
|
||||
log(event)
|
||||
event_frame:RegisterEvent(event)
|
||||
end
|
||||
|
||||
@@ -188,12 +193,6 @@ do
|
||||
end)
|
||||
end
|
||||
|
||||
function public.log(...) temp=arg
|
||||
local msg = '[aux]'
|
||||
for i=1,arg.n do msg = msg..' '..tostring(arg[i]) end
|
||||
DEFAULT_CHAT_FRAME:AddMessage(LIGHTYELLOW_FONT_COLOR_CODE..msg)
|
||||
end
|
||||
|
||||
tab_info = t
|
||||
do
|
||||
local data = -temp-list('search_tab', 'Search', 'post_tab', 'Post', 'auctions_tab', 'Auctions', 'bids_tab', 'Bids')
|
||||
@@ -212,7 +211,7 @@ end
|
||||
|
||||
do
|
||||
local index
|
||||
function active_tab.get() return tab_info[index] end
|
||||
function private.active_tab.get() return tab_info[index] end
|
||||
function on_tab_click(i)
|
||||
call(index and active_tab.CLOSE)
|
||||
index = i
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ end
|
||||
|
||||
do
|
||||
local id = 0
|
||||
function id.get() id = id + 1; return id end
|
||||
function private.id.get() id = id + 1; return id end
|
||||
end
|
||||
|
||||
function public.kill_listener(listener_id)
|
||||
|
||||
+3
-3
@@ -6,7 +6,7 @@ value_cache = t
|
||||
|
||||
do
|
||||
local cache
|
||||
function data.get()
|
||||
function private.data.get()
|
||||
if not cache then
|
||||
local dataset = persistence.dataset
|
||||
cache = dataset.history or t
|
||||
@@ -18,7 +18,7 @@ end
|
||||
|
||||
do
|
||||
local time = 0
|
||||
function next_push.get()
|
||||
function private.next_push.get()
|
||||
if time() > time then
|
||||
local date = date '*t'
|
||||
date.hour, date.min, date.sec = 24, 0, 0
|
||||
@@ -28,7 +28,7 @@ do
|
||||
end
|
||||
end
|
||||
|
||||
function new_record.get()
|
||||
function private.new_record.get()
|
||||
return -object('next_push', next_push, 'data_points', t)
|
||||
end
|
||||
|
||||
|
||||
+2
-2
@@ -37,13 +37,13 @@ do
|
||||
call(on_complete)
|
||||
end
|
||||
|
||||
function state.get()
|
||||
function private.state.get()
|
||||
local _, state = next(filter(scan_states, function(state) return state.id == thread_id end))
|
||||
return state
|
||||
end
|
||||
end
|
||||
|
||||
function query.get() return state.params.queries[state.query_index] end
|
||||
function private.query.get() return state.params.queries[state.query_index] end
|
||||
|
||||
function wait_for_callback(...) temp=arg
|
||||
local send_signal, signal_received = signal()
|
||||
|
||||
+3
-7
@@ -51,13 +51,9 @@ do
|
||||
state.declaration_access, state.declaration_name = nil, nil
|
||||
end
|
||||
function declarator_mt:__call(value) local state=_state[self]
|
||||
if state.declaration_name then
|
||||
local success, f, getter, setter = pcall(extract, value)
|
||||
if not success then declaration_error() end
|
||||
declare(state, state.declaration_access, state.declaration_name, {[FUNCTION]=f, [GETTER]=getter, [SETTER]=setter})
|
||||
elseif state.declaration_access or declaration_error() then
|
||||
state.default_access = state.declaration_access
|
||||
end
|
||||
local success, f, getter, setter = pcall(extract, value)
|
||||
if not (success and state.declaration_name) then declaration_error() end
|
||||
declare(state, state.declaration_access, state.declaration_name, {[FUNCTION]=f, [GETTER]=getter, [SETTER]=setter})
|
||||
state.declaration_access, state.declaration_name = nil, nil
|
||||
end
|
||||
end
|
||||
|
||||
+2
-2
@@ -4,13 +4,13 @@ aux 'post_tab' local scan, scan_util, post, history, info, persistence, item_lis
|
||||
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'}}
|
||||
|
||||
function default_settings.get()
|
||||
function private.default_settings.get()
|
||||
return -object('duration', DURATION_8 , 'stack_size', 1, 'start_price', 0, 'buyout_price', 0, 'hidden', false)
|
||||
end
|
||||
|
||||
do
|
||||
local data
|
||||
function data.get()
|
||||
function private.data.get()
|
||||
if not data then
|
||||
local dataset = persistence.dataset
|
||||
data = dataset.post or t
|
||||
|
||||
@@ -78,7 +78,7 @@ function USE_ITEM(item_info)
|
||||
execute(nil, false)
|
||||
end
|
||||
|
||||
function subtab.set(tab)
|
||||
function private.subtab.set(tab)
|
||||
search_results_button:UnlockHighlight()
|
||||
saved_searches_button:UnlockHighlight()
|
||||
new_filter_button:UnlockHighlight()
|
||||
|
||||
@@ -23,7 +23,7 @@ do
|
||||
local searches = t
|
||||
local search_index = 1
|
||||
|
||||
function current_search.get() return searches[search_index] end
|
||||
function private.current_search.get() return searches[search_index] end
|
||||
|
||||
function update_search(index)
|
||||
searches[search_index].status_bar:Hide()
|
||||
|
||||
Reference in New Issue
Block a user