Module:Sandbox/Sameboat/m1: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 1:
local p = {}
function p.format11id( frame )
local pframe = frame:getParent()
local config = frame.args -- arguments from the template definition
local args = pframe.args -- arguments from the page calling the template
local system = frame.args[1]
local code = frame.args[2]
Line 12:
local data = require('Module:HK-MTR_stations/' .. system)
local station = data.stations[code]
return code .. '' .. station.id
end
 
function p.link( frame )
local pframe = frame:getParent()
local config = frame.args
local args = pframe.args
local system = frame.args[1]
local code = frame.args[2]
if not system or not code then
return 'error'
end
local data = require('Module:HK-MTR_stations/' .. system)
local station = data.stations[code]
return code .. station.link
end