Module:TAMNAMS: Difference between revisions

Ganaram inukshuk (talk | contribs)
m Changes to lookup table names
Ganaram inukshuk (talk | contribs)
m Bugfix for hardness lookup; revert "hardness_names" back to "step_ratio(s)"
Line 20: Line 20:


-- Lookup table for tamnams step ratios
-- Lookup table for tamnams step ratios
p.hardness_names = {
p.step_ratios = {
['1:1'] = 'equalized',
['1:1'] = 'equalized',
['4:3'] = 'supersoft',
['4:3'] = 'supersoft',
Line 33: Line 33:


-- And step ratio ranges
-- And step ratio ranges
p.hardness_ranges = {
p.step_ratio_ranges = {
['1:1 to 2:1'] = 'soft-of-basic',
['1:1 to 2:1'] = 'soft-of-basic',
['1:1 to 3:2'] = 'soft',
['1:1 to 3:2'] = 'soft',
Line 51: Line 51:


-- Lookup table for tamnams extended step ratios
-- Lookup table for tamnams extended step ratios
p.hardness_names_ext = {
p.step_ratios_ext = {
['1:1'] = 'equalized',
['1:1'] = 'equalized',
['6:5'] = 'semiequalized',
['6:5'] = 'semiequalized',
Line 67: Line 67:


-- And extended step ratio ranges
-- And extended step ratio ranges
p.hardness_ranges_ext = {
p.step_ratio_ranges_ext = {
['1:1 to 2:1'] = 'soft-of-basic',
['1:1 to 2:1'] = 'soft-of-basic',
['1:1 to 3:2'] = 'soft',
['1:1 to 3:2'] = 'soft',
Line 343: Line 343:
-- use_extended is used to toggle between central range and extended range
-- use_extended is used to toggle between central range and extended range
local key = rat.as_ratio(step_ratio, ':')
local key = rat.as_ratio(step_ratio, ':')
local named_ratio = use_extended and p.ratios_ext[key] or p.ratios[key]
local named_ratio = use_extended and p.step_ratios_ext[key] or p.step_ratios[key]
return named_ratio
return named_ratio
Line 367: Line 367:
-- use_extended is used to toggle between central range and extended range
-- use_extended is used to toggle between central range and extended range
local named_ratio_range = use_extended and p.hardness_ranges_ext[key] or p.hardness_ranges[key]
local named_ratio_range = use_extended and p.step_ratio_ranges_ext[key] or p.step_ratio_ranges[key]
return named_ratio_range
return named_ratio_range