Module:Uniform map: Difference between revisions
ArrowHead294 (talk | contribs) mNo edit summary |
add some defaults for range |
||
Line 93: | Line 93: | ||
local lb = p.lower_bound(map_table) -- Minimum size for the current map | local lb = p.lower_bound(map_table) -- Minimum size for the current map | ||
local ub = p.upper_bound(map_table) -- Maximum size for the current map | local ub = p.upper_bound(map_table) -- Maximum size for the current map | ||
local row = {"Min. size", "Max. size", "[[Wart notation]]"} | local row = { "Min. size", "Max. size", "[[Wart notation]]" } | ||
for i = 1, #map_table.map do | for i = 1, #map_table.map do | ||
table.insert(row, utils.primes[i]) | table.insert(row, utils.primes[i]) | ||
Line 99: | Line 99: | ||
table.insert(maptable, row) | table.insert(maptable, row) | ||
while lb < max do | while lb < max do | ||
row = {string.format("%.4f", lb), string.format("%.4f", ub), p.wart(map_table.map)} | row = { string.format("%.4f", lb), string.format("%.4f", ub), p.wart(map_table.map) } | ||
for j = 1, #map_table.map do | for j = 1, #map_table.map do | ||
table.insert(row, map_table.map[j]) | table.insert(row, map_table.map[j]) | ||
Line 118: | Line 118: | ||
local max = args[3] | local max = args[3] | ||
local debugg = yesno(args["debug"]) | local debugg = yesno(args["debug"]) | ||
if utils. | prime = utils.eval_num_arg(prime, 5) | ||
if max == nil then | |||
local edo = utils.eval_num_arg(min, 12.0) | |||
-- default to +/- 0.2 | |||
min = edo - 0.2 | |||
max = edo + 0.2 | |||
else | |||
min = utils.eval_num_arg(min, 11.5) | |||
max = utils.eval_num_arg(max, 12.5) | |||
end | |||
if utils.index_of(utils.primes, prime) == nil then | |||
prime = 5 -- Default to 5-limit | prime = 5 -- Default to 5-limit | ||
end | end | ||
local luatable = p.make_table(prime, | local luatable = p.make_table(prime, min, max) | ||
local wtable = | local wtable = '{| class="wikitable"\n' | ||
.. | .. '|+ style="font-size: 105%; | ' | ||
.. string.format("%d-limit [[uniform map]]s between %g and %g\n", prime, min, max) | .. string.format("%d-limit [[uniform map]]s between %g and %g\n", prime, min, max) | ||
.. "|-\n" | .. "|-\n" | ||
Line 143: | Line 155: | ||
end | end | ||
wtable = wtable .. "|}" | wtable = wtable .. "|}" | ||
return frame:preprocess(debugg == true and "<pre>" .. wtable .. "</pre>" or wtable) | return frame:preprocess(debugg == true and "<pre>" .. wtable .. "</pre>" or wtable) | ||
end | end | ||
return p | return p |