ipairs refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-11-26 18:28:01 +01:00
parent 90d92ecc34
commit 3f3c7b28fc
9 changed files with 47 additions and 39 deletions
+2 -2
View File
@@ -115,8 +115,8 @@ function update_auction_listing()
local unit_start_price = get_unit_start_price()
local unit_buyout_price = get_unit_buyout_price()
for i, auction_record in ipairs(existing_auctions[selected_item.key] or empty) do
for i = 1, getn(existing_auctions[selected_item.key] or empty) do
local auction_record = existing_auctions[selected_item.key][i]
local blizzard_bid_undercut, buyout_price_undercut = undercut(auction_record, stack_size_slider:GetValue())
blizzard_bid_undercut = money.from_string(money.to_string(blizzard_bid_undercut, true, nil, 3))
buyout_price_undercut = money.from_string(money.to_string(buyout_price_undercut, true, nil, 3))
+5 -3
View File
@@ -155,7 +155,8 @@ end
function set_form(filter)
clear_form()
for _, component in ipairs(filter.components) do
for i = 1, getn(filter.components) do
local component = filter.components[i]
if component[1] == 'blizzard' then
blizzard_query[component[2]] = component[4]
else
@@ -201,13 +202,14 @@ function formatted_post_filter(components)
local stack = temp-T
local str = ''
for i, component in ipairs(components) do
for i = 1, getn(components) do
local component = components[i]
if no_line_break then
str = str .. ' '
end
str = str .. '</p><p>'
for _ = 1, getn(stack) + 1 do
str = str .. color.content.background('----')
str = str .. color.content.background'----'
end
no_line_break = component[1] == 'operator' and component[2] == 'not'
+6 -4
View File
@@ -8,7 +8,8 @@ _G.aux_recent_searches = T
function update_search_listings()
local favorite_search_rows = T
for i, search in ipairs(aux_favorite_searches) do
for i = 1, getn(aux_favorite_searches) do
local search = aux_favorite_searches[i]
local name = strsub(search.prettified, 1, 250)
tinsert(favorite_search_rows, O(
'cols', A(O('value', search.auto_buy and color.red'A' or ''), O('value', name)),
@@ -19,11 +20,12 @@ function update_search_listings()
favorite_searches_listing:SetData(favorite_search_rows)
local recent_search_rows = T
for i, recent_search in ipairs(aux_recent_searches) do
local name = strsub(recent_search.prettified, 1, 250)
for i = 1, getn(aux_recent_searches) do
local search = aux_recent_searches[i]
local name = strsub(search.prettified, 1, 250)
tinsert(recent_search_rows, O(
'cols', A(O('value', name)),
'search', recent_search,
'search', search,
'index', i
))
end