refactoring
This commit is contained in:
+4
-4
@@ -20,14 +20,14 @@ end
|
||||
|
||||
do
|
||||
local formal_parameters = t
|
||||
for i=1,9 do
|
||||
for i = 1, 9 do
|
||||
local key = '_'..i
|
||||
public[key] = t
|
||||
formal_parameters[M[key]] = i
|
||||
end
|
||||
local function helper(f, arg1, arg2)
|
||||
local params = t
|
||||
for i=1,arg1.n do
|
||||
for i = 1, arg1.n do
|
||||
if formal_parameters[arg1[i]] then
|
||||
tinsert(params, arg2[formal_parameters[arg1[i]]])
|
||||
else
|
||||
@@ -58,7 +58,7 @@ function public.call(f, ...) temp=arg
|
||||
end
|
||||
|
||||
function public.index(t, ...) temp=arg
|
||||
for i=1,arg.n do
|
||||
for i = 1, arg.n do
|
||||
t = t and t[arg[i]]
|
||||
end
|
||||
return t
|
||||
@@ -94,7 +94,7 @@ end
|
||||
|
||||
function public.expand(array, ...) temp=arg
|
||||
local t = t
|
||||
for i=1,arg.n do t[arg[i]] = array[i] end
|
||||
for i = 1, arg.n do t[arg[i]] = array[i] end
|
||||
return t
|
||||
end
|
||||
|
||||
|
||||
+2
-2
@@ -402,7 +402,7 @@ function suggestions(components)
|
||||
|
||||
-- rarities
|
||||
if not components.blizzard.quality then
|
||||
for i=0,4 do tinsert(suggestions, _G['ITEM_QUALITY'..i..'_DESC']) end
|
||||
for i = 0, 4 do tinsert(suggestions, _G['ITEM_QUALITY'..i..'_DESC']) end
|
||||
end
|
||||
|
||||
-- item names
|
||||
@@ -534,7 +534,7 @@ function validator(components)
|
||||
return false
|
||||
end
|
||||
local stack = {}
|
||||
for i=getn(components.post),1,-1 do
|
||||
for i = getn(components.post), 1, -1 do
|
||||
local type, name, param = unpack(components.post[i])
|
||||
if type == 'operator' then
|
||||
local args = {}
|
||||
|
||||
+3
-3
@@ -236,7 +236,7 @@ function public.load_tooltip(frame, tooltip)
|
||||
frame:AddLine(line.left_text, line.left_color[1], line.left_color[2], line.left_color[3], true)
|
||||
end
|
||||
end
|
||||
for i=1,getn(tooltip) do -- TODO why is this needed?
|
||||
for i = 1, getn(tooltip) do -- TODO why is this needed?
|
||||
_G[frame:GetName()..'TextLeft'..i]:SetJustifyH('LEFT')
|
||||
_G[frame:GetName()..'TextRight'..i]:SetJustifyH('LEFT')
|
||||
end
|
||||
@@ -273,7 +273,7 @@ function public.tooltip(setter)
|
||||
AuxTooltip:Show()
|
||||
|
||||
local tooltip = t
|
||||
for i=1,AuxTooltip:NumLines() do
|
||||
for i = 1, AuxTooltip:NumLines() do
|
||||
tinsert(tooltip, {
|
||||
left_text = _G['AuxTooltipTextLeft'..i]:GetText(),
|
||||
left_color = {_G['AuxTooltipTextLeft'..i]:GetTextColor()},
|
||||
@@ -395,7 +395,7 @@ function public.item_slot_index(class_index, subclass_index, slot_name)
|
||||
end
|
||||
|
||||
function public.item_quality_index(item_quality)
|
||||
for i=0,4 do
|
||||
for i = 0, 4 do
|
||||
local quality = _G['ITEM_QUALITY'..i..'_DESC']
|
||||
if strupper(item_quality) == strupper(quality) then
|
||||
return i, quality
|
||||
|
||||
@@ -69,7 +69,7 @@ function public.read_record(schema, str)
|
||||
local separator = schema[2]
|
||||
local record = t
|
||||
local parts = split(str, separator)
|
||||
for i=3,getn(schema) do
|
||||
for i = 3, getn(schema) do
|
||||
local key, type = next(schema[i])
|
||||
record[key] = read(type, parts[i - 2])
|
||||
end
|
||||
@@ -79,7 +79,7 @@ end
|
||||
function public.write_record(schema, record)
|
||||
local separator = schema[2]
|
||||
local parts = tt
|
||||
for i=3,getn(schema) do
|
||||
for i = 3, getn(schema) do
|
||||
local key, type = next(schema[i])
|
||||
tinsert(parts, write(type, record[key]))
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user