Module:MOS modes: Difference between revisions
No edit summary |
No edit summary |
||
| Line 50: | Line 50: | ||
-- TODO: | -- TODO: | ||
-- - Allow for mos to be extracted from the page's title for use as a future template | -- - Allow for mos to be extracted from the page's title for use as a future template | ||
-- - Allow for input of mode names | -- - Allow for input of mode names | ||
-- - Expand this (possibly as a separate template) for mos intervals | -- - Expand this (possibly as a separate template) for mos intervals | ||
| Line 59: | Line 58: | ||
local mos_modes = p.modes_by_brightness(input_mos) | local mos_modes = p.modes_by_brightness(input_mos) | ||
local periods = rat.gcd(input_mos.nL, input_mos.ns) -- Needed for UDP | |||
-- Make a | -- Make a table with a column for the mode (as a string of L's and s's) and UDP | ||
local result = '{| class="wikitable"\n' | local result = '{| class="wikitable"\n' | ||
result = result .. "|+\n" | result = result .. "|+ " .. "Modes of " .. mosstring .. "\n" | ||
result = result .. "|-\n" | result = result .. "|-\n" | ||
result = result .. "! | result = result .. "! Mode\n" | ||
result = result .. "! [[UDP]]\n" | |||
-- Enter each row | -- Enter each row | ||
for i = 1, #mos_modes do | for i = 1, #mos_modes do | ||
result = result .. "|-\n" | result = result .. "|-\n" | ||
-- Add the mode's string | |||
result = result .. "|" .. mos_modes[i] .. "\n" | result = result .. "|" .. mos_modes[i] .. "\n" | ||
-- Add the UDP, formatted as up|dp, where u is the number of bright generators going up, | |||
-- d is the number of bright generators going down, and p is the number of periods | |||
-- (slightly different from standard UDP notation of u|d(p)) | |||
local gens_up = (i - 1) * periods | |||
local gens_down = (#mos_modes - i - 1) * periods | |||
result = result .. "|" .. gens_up .. "<nowiki>|</nowiki>" .. gens_down | |||
end | end | ||