Module:Q-odd-limit intervals: Difference between revisions

Refactoring
Ideally we should only make the table when called for. Here's the first step to approach that.
Line 188: Line 188:
end
end
local out_str_direct = t_head_0 .. t_title .. tag_direct .. "\n" .. t_head_1 .. table.concat(t_body_direct, "\n") .. t_foot
local out_str_val = t_head_0 .. t_title .. tag_val .. "\n" .. t_head_1 .. table.concat(t_body_val, "\n") .. t_foot
if approx_t == "direct" then
if approx_t == "direct" then
local out_str_direct = t_head_0 .. t_title .. tag_direct .. "\n" .. t_head_1 .. table.concat(t_body_direct, "\n") .. t_foot
return out_str_direct
return out_str_direct
elseif approx_t == "val" then
elseif approx_t == "val" then
local out_str_val = t_head_0 .. t_title .. tag_val .. "\n" .. t_head_1 .. table.concat(t_body_val, "\n") .. t_foot
return out_str_val
return out_str_val
else
return out_str_direct .. "\n\n" .. out_str_val
end
end
end
end
Line 250: Line 247:
out_str = ""
out_str = ""
end
end
out_str = out_str .. approx(steps, subgroup, monzo_list, title, tag, apx)
if utils.value_provided (apx) then
out_str = out_str .. approx(steps, subgroup, monzo_list, title, tag, apx)
else
out_str = out_str .. approx(steps, subgroup, monzo_list, title, tag, "direct") .. approx(steps, subgroup, monzo_list, title, tag, "val")
end
return out_str
return out_str
end
end


return p;
return p;