refactoring
This commit is contained in:
@@ -77,7 +77,7 @@ function SlashCmdList.AUX(command)
|
||||
tinsert(chars, name)
|
||||
end
|
||||
if getn(chars) > 0 then
|
||||
aux.log('Your characters: "'..aux.util.join(chars, ', ')..'".')
|
||||
aux.log('Your characters: "'..table.concat(chars, ', ')..'".')
|
||||
else
|
||||
aux.log('You don\'t have any additional characters. To add your characters type "/aux chars add NAME1 NAME2 NAME3...".')
|
||||
end
|
||||
|
||||
@@ -8,13 +8,13 @@ do
|
||||
local data = {}
|
||||
local mt = {
|
||||
__newindex = function(self, key, value)
|
||||
data[self].getter({public=self, private=data[self].state})[key] = value
|
||||
data[self].getter{public=self, private=data[self].state}[key] = value
|
||||
end,
|
||||
__index = function(self, key)
|
||||
return data[self].getter({public=self, private=data[self].state})[key]
|
||||
return data[self].getter{public=self, private=data[self].state}[key]
|
||||
end,
|
||||
__call = function(self)
|
||||
return data[self].getter({public=self, private=data[self].state})
|
||||
return data[self].getter{public=self, private=data[self].state}
|
||||
end,
|
||||
}
|
||||
function public.dynamic_table(state, getter)
|
||||
|
||||
@@ -336,7 +336,7 @@ function private.create_frames()
|
||||
if filters then
|
||||
tinsert(aux_favorite_searches, 1, {
|
||||
filter_string = m.search_box:GetText(),
|
||||
prettified = aux.util.join(aux.util.map(filters, function(filter) return filter.prettified end), ';'),
|
||||
prettified = table.concat(aux.util.map(filters, function(filter) return filter.prettified end), ';'),
|
||||
})
|
||||
end
|
||||
m.update_search_listings()
|
||||
|
||||
@@ -335,7 +335,7 @@ function public.execute(resume, real_time)
|
||||
else
|
||||
m.new_search(filter_string)
|
||||
end
|
||||
m.new_recent_search(filter_string, aux.util.join(aux.util.map(queries, function(filter) return filter.prettified end), ';'))
|
||||
m.new_recent_search(filter_string, table.concat(aux.util.map(queries, function(filter) return filter.prettified end), ';'))
|
||||
else
|
||||
m.current_search().records = {}
|
||||
m.current_search().table:SetDatabase(m.current_search().records)
|
||||
|
||||
@@ -158,15 +158,6 @@ function public.trim(str)
|
||||
return gsub(str, '^%s*(.-)%s*$', '%1')
|
||||
end
|
||||
|
||||
function public.join(parts, separator)
|
||||
local str = parts[1] or ''
|
||||
for i=2,getn(parts) do
|
||||
if not parts[i] then break end
|
||||
str = str..separator..parts[i]
|
||||
end
|
||||
return str
|
||||
end
|
||||
|
||||
function public.split(str, separator)
|
||||
local parts = {}
|
||||
while true do
|
||||
|
||||
+3
-3
@@ -124,8 +124,8 @@ function public.auction(index, query_type)
|
||||
hyperlink = hyperlink,
|
||||
itemstring = item_info.itemstring,
|
||||
item_key = item_id..':'..suffix_id,
|
||||
search_signature = aux.util.join({item_id, suffix_id, enchant_id, start_price, buyout_price, bid_price, aux_quantity, duration, query_type == 'owner' and high_bidder or (high_bidder and 1 or 0), aux_ignore_owner and (aux.is_player(owner) and 0 or 1) or (owner or '?')}, ':'),
|
||||
sniping_signature = aux.util.join({item_id, suffix_id, enchant_id, start_price, buyout_price, aux_quantity, aux_ignore_owner and (aux.is_player(owner, true) and 0 or 1) or (owner or '?')}, ':'),
|
||||
search_signature = table.concat({item_id, suffix_id, enchant_id, start_price, buyout_price, bid_price, aux_quantity, duration, query_type == 'owner' and high_bidder or (high_bidder and 1 or 0), aux_ignore_owner and (aux.is_player(owner) and 0 or 1) or (owner or '?')}, ':'),
|
||||
sniping_signature = table.concat({item_id, suffix_id, enchant_id, start_price, buyout_price, aux_quantity, aux_ignore_owner and (aux.is_player(owner, true) and 0 or 1) or (owner or '?')}, ':'),
|
||||
|
||||
name = name,
|
||||
texture = texture,
|
||||
@@ -169,7 +169,7 @@ function public.bid_update(auction_record)
|
||||
auction_record.unit_blizzard_bid = auction_record.blizzard_bid / auction_record.aux_quantity
|
||||
auction_record.unit_bid_price = auction_record.bid_price / auction_record.aux_quantity
|
||||
auction_record.high_bidder = 1
|
||||
auction_record.search_signature = aux.util.join({auction_record.item_id, auction_record.suffix_id, auction_record.enchant_id, auction_record.start_price, auction_record.buyout_price, auction_record.bid_price, auction_record.aux_quantity, auction_record.duration, 1, aux_ignore_owner and (aux.is_player(auction_record.owner) and 0 or 1) or (auction_record.owner or '?')}, ':')
|
||||
auction_record.search_signature = table.concat({auction_record.item_id, auction_record.suffix_id, auction_record.enchant_id, auction_record.start_price, auction_record.buyout_price, auction_record.bid_price, auction_record.aux_quantity, auction_record.duration, 1, aux_ignore_owner and (aux.is_player(auction_record.owner) and 0 or 1) or (auction_record.owner or '?')}, ':')
|
||||
end
|
||||
|
||||
function public.set_tooltip(itemstring, owner, anchor)
|
||||
|
||||
+1
-1
@@ -92,7 +92,7 @@ function public.to_string(money, pad, trim, decimal_points, color, no_color)
|
||||
if copper > 0 or gold == 0 and silver == 0 then
|
||||
tinsert(parts, m.format_number(copper, pad, decimal_points, color)..copper_text)
|
||||
end
|
||||
text = aux.util.join(parts, ' ')
|
||||
text = table.concat(parts, ' ')
|
||||
else
|
||||
if gold > 0 then
|
||||
text = m.format_number(gold, false, nil, color)..gold_text..' '..m.format_number(silver, pad, nil, color)..silver_text..' '..m.format_number(copper, pad, decimal_points, color)..copper_text
|
||||
|
||||
@@ -72,7 +72,7 @@ function public.write_list(schema, list)
|
||||
local parts = aux.util.map(list, function(element)
|
||||
return m.write(element_type, element)
|
||||
end)
|
||||
return aux.util.join(parts, separator)
|
||||
return table.concat(parts, separator)
|
||||
end
|
||||
|
||||
function public.read_record(schema, str)
|
||||
@@ -93,7 +93,7 @@ function public.write_record(schema, record)
|
||||
local key, type = next(schema[i])
|
||||
tinsert(parts, m.write(type, record[key]))
|
||||
end
|
||||
return aux.util.join(parts, separator)
|
||||
return table.concat(parts, separator)
|
||||
end
|
||||
|
||||
function public.serialize(data, separator, compactor)
|
||||
|
||||
Reference in New Issue
Block a user