Module:Sandbox/Szqecs/Kaohsiung/functions

function r_count_func(...) if arg[n] then return (arg[n] - 1) / 3 else return 1 end end

function interpret(_, x, y, z)	line = x	position = z	if x == 'r' then if type(tonumber(y)) == 'number' then local y = tonumber(y) if y < 5 then index = y - 2 elseif y > 22 then index = y			else index = y - 1 end elseif y == '4a' then index = 3 elseif y == '22a' then index = 22 end elseif x == 'o' then if type(tonumber(y)) == 'number' then local y = tonumber(y) if y < 4 then index = y			else index = y - 1 end elseif y == 't1' then index = 14 end end end

function s_link(x) if x then hsr = { ['Zuoying'] = '', }		stn = { ['Kaohsiung Main'] = '', ['Ciaotou'] = 'Qiaotou' }		if not stn[x] and not hsr[x] then return '\[\[' .. x .. ' MRT station|' .. x .. '\]\]'		elseif stn[x] then if stn[x] == '' then return '\[\[' .. x .. ' station|' .. x .. '\]\]'			else return '\[\[' .. stn[x] .. ' station|' .. x .. '\]\]'			end elseif hsr[x] then if hsr[x] == '' then return '\[\[' .. x .. ' HSR station|' .. x .. '\]\]'			else return '\[\[' .. hsr[x] .. ' station|' .. x .. '\]\]'			end end end end