Module:Scale tree: Difference between revisions

Ganaram inukshuk (talk | contribs)
Revert edits, changes didn't look right
Ganaram inukshuk (talk | contribs)
Bolded default comments, added back "generators smaller than this are proper" to appropriate mosses
Line 80: Line 80:
-- Default comments for TAMNAMS-named step ratios
-- Default comments for TAMNAMS-named step ratios
local default_comments = {}
local default_comments = {}
default_comments["1/1"] = "Equalized " .. MOS.as_string(input_mos)
local mos_as_string = MOS.as_string(input_mos)
default_comments["4/3"] = "Supersoft " .. MOS.as_string(input_mos)
default_comments["1/1"] = string.format("'''Equalized %s'''", mos_as_string)
default_comments["3/2"] = "Soft " .. MOS.as_string(input_mos)
default_comments["4/3"] = string.format("'''Supersoft %s'''", mos_as_string)
default_comments["5/3"] = "Semisoft " .. MOS.as_string(input_mos)
default_comments["3/2"] = string.format("'''Soft %s'''", mos_as_string)
default_comments["2/1"] = "Basic " .. MOS.as_string(input_mos)
default_comments["5/3"] = string.format("'''Semisoft %s'''", mos_as_string)
default_comments["5/2"] = "Semihard " .. MOS.as_string(input_mos)
default_comments["2/1"] = string.format("'''Basic %s'''", mos_as_string)
default_comments["3/1"] = "Hard " .. MOS.as_string(input_mos)
default_comments["5/2"] = string.format("'''Semihard %s'''", mos_as_string)
default_comments["4/1"] = "Superhard " .. MOS.as_string(input_mos)
default_comments["3/1"] = string.format("'''Hard %s'''", mos_as_string)
default_comments["1/0"] = "Collapsed " .. MOS.as_string(input_mos)
default_comments["4/1"] = string.format("'''Superhard %s'''", mos_as_string)
default_comments["1/0"] = string.format("'''Collapsed %s'''", mos_as_string)
-- Append boundary of proper scales to basic comment, if applicable
if n ~= ns then
default_comments["2/1"] = default_comments["2/1"] .. "Bright generators smaller than this are proper"
end
-- Create table
-- Create table
Line 158: Line 164:
-- Cell for comment
-- Cell for comment
-- Default comments are on their own line before custom comments
local key = step_ratios[i][1] .. "/" .. step_ratios[i][2] -- The step ratio is (literally and figuratively) the key to add comments!
local key = step_ratios[i][1] .. "/" .. step_ratios[i][2] -- The step ratio is (literally and figuratively) the key to add comments!
-- Check for comments
local contains_custom_comment = comments[key] ~= nil
local contains_default_comment = default_comments[key] ~= nil
local comment = ""
local comment = ""
if contains_default_comment and contains_custom_comment then
local default_comment = default_comments[key] or ""
comment = comment .. default_comments[key] .. "<br>" .. comments[key]
local custom_comment = comments[key] or ""
elseif contains_default_comment and not contains_custom_comment then
if default_comment ~= "" then
comment = comment .. default_comments[key]
comment = custom_comment
elseif not contains_default_comment and contains_custom_comment then
else
comment = comment .. comments[key]
comment = default_comment .. "<br>" .. custom_comment
end
end
result = result .. string.format("| %s\n", comment)
result = result .. string.format("| %s\n", comment)