Difference between revisions of "Module:Slope"
From ALttP Speedrunning Wiki
(Created page with "local p = {} local slope_symbols = { ['◢'] = { '/', '/bottom', 'bottom/', 'acute', 'acutebottom', 'bottomacute' }, ['◣'] = { '\\', '\\bottom', 'bottom\\', 'grave', 'gra...") |
(No difference)
|
Revision as of 13:25, 22 December 2018
Documentation for this module may be created at Module:Slope/doc
local p = {} local slope_symbols = { ['◢'] = { '/', '/bottom', 'bottom/', 'acute', 'acutebottom', 'bottomacute' }, ['◣'] = { '\\', '\\bottom', 'bottom\\', 'grave', 'gravebottom', 'bottomgrave' }, ['◤'] = { '/', '/top', 'top/', 'acute', 'acutetop', 'topacute' }, ['◥'] = { '\\', '\\top', 'top\\', 'grave', 'gravetop', 'topgrave' } } function p.main(frame) local args = frame:getParent().args local slope = args[1] or '' slope = slope:lower():gsub(' ','') local ret for v, w in pairs(slope_symbols) do for _, x in ipairs(w) do if slope == x then ret = v break end end end if not ret then error('No valid slope defined') end return string.format('<span style="font-size:110%;">%s</span>', ret) end return p