refactoring
This commit is contained in:
+4
-14
@@ -4,7 +4,7 @@ local next, getn, setn, tremove, type, setmetatable = next, getn, table.setn, tr
|
|||||||
|
|
||||||
local wipe, acquire, release, set_auto_release
|
local wipe, acquire, release, set_auto_release
|
||||||
do
|
do
|
||||||
local pool, pool_size, overflow_pool, auto_release = {}, 0, setmetatable({}, { __mode='k' }), {}
|
local pool, pool_size, overflow_pool, auto_release = {}, 0, setmetatable({}, {__mode='k'}), {}
|
||||||
|
|
||||||
function wipe(t)
|
function wipe(t)
|
||||||
setmetatable(t, nil)
|
setmetatable(t, nil)
|
||||||
@@ -31,6 +31,7 @@ do
|
|||||||
end
|
end
|
||||||
return {}
|
return {}
|
||||||
end
|
end
|
||||||
|
M.acquire = acquire
|
||||||
|
|
||||||
function release(t)
|
function release(t)
|
||||||
wipe(t)
|
wipe(t)
|
||||||
@@ -72,17 +73,6 @@ M.perm = setmetatable({}, {
|
|||||||
__sub = function(_, v) set_auto_release(v, false); return v end,
|
__sub = function(_, v) set_auto_release(v, false); return v end,
|
||||||
})
|
})
|
||||||
|
|
||||||
M.init = setmetatable({}, {
|
|
||||||
__metatable = false,
|
|
||||||
__newindex = function(_, t, init)
|
|
||||||
wipe(t)
|
|
||||||
for k, v in init do
|
|
||||||
t[k] = v
|
|
||||||
setn(t, getn(init))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
do
|
do
|
||||||
local function ret(t)
|
local function ret(t)
|
||||||
if getn(t) > 0 then
|
if getn(t) > 0 then
|
||||||
@@ -94,7 +84,7 @@ do
|
|||||||
M.ret = ret
|
M.ret = ret
|
||||||
end
|
end
|
||||||
|
|
||||||
M.empty = setmetatable({}, { __metatable=false, __newindex=nop })
|
M.empty = setmetatable({}, {__metatable=false, __newindex=nop})
|
||||||
|
|
||||||
local vararg
|
local vararg
|
||||||
do
|
do
|
||||||
@@ -134,7 +124,7 @@ do
|
|||||||
|
|
||||||
function vararg(f)
|
function vararg(f)
|
||||||
local chunk = loadstring(code)
|
local chunk = loadstring(code)
|
||||||
setfenv(chunk, { f=f, setn=setn, acquire=acquire, set_auto_release=set_auto_release })
|
setfenv(chunk, {f=f, setn=setn, acquire=acquire, set_auto_release=set_auto_release})
|
||||||
return chunk()
|
return chunk()
|
||||||
end
|
end
|
||||||
M.vararg = setmetatable({}, {
|
M.vararg = setmetatable({}, {
|
||||||
|
|||||||
+2
-1
@@ -438,7 +438,8 @@ function update_inventory_records()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
init[inventory_records] = temp-values(auctionable_map)
|
release(inventory_records)
|
||||||
|
inventory_records = values(auctionable_map)
|
||||||
sort(inventory_records, function(a, b) return a.name < b.name end)
|
sort(inventory_records, function(a, b) return a.name < b.name end)
|
||||||
refresh = true
|
refresh = true
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -176,7 +176,8 @@ function clear_form()
|
|||||||
UIDropDownMenu_ClearAll(quality_dropdown)
|
UIDropDownMenu_ClearAll(quality_dropdown)
|
||||||
filter_parameter_input:ClearFocus()
|
filter_parameter_input:ClearFocus()
|
||||||
wipe(post_filter)
|
wipe(post_filter)
|
||||||
init[filter_builder_state] = temp-T('selected', 0)
|
wipe(filter_builder_state)
|
||||||
|
filter_builder_state.selected = 0
|
||||||
update_filter_display()
|
update_filter_display()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -180,7 +180,8 @@ function start_real_time_scan(query, search, continuation)
|
|||||||
for _, record in new_records do
|
for _, record in new_records do
|
||||||
map[record.sniping_signature] = record
|
map[record.sniping_signature] = record
|
||||||
end
|
end
|
||||||
init[new_records] = temp-values(map)
|
release(new_records)
|
||||||
|
new_records = values(map)
|
||||||
|
|
||||||
if getn(new_records) > 2000 then
|
if getn(new_records) > 2000 then
|
||||||
StaticPopup_Show'AUX_SEARCH_TABLE_FULL'
|
StaticPopup_Show'AUX_SEARCH_TABLE_FULL'
|
||||||
|
|||||||
Reference in New Issue
Block a user