Module:Station: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 18: | Line 18: | ||
end | end | ||
end | end | ||
return "Code "+frame.args.code+" not found" | |||
end | end | ||
Revision as of 00:45, 9 January 2026
Documentation for this module may be created at Module:Station/doc
local p = {}
-- Load JSON data
local data = mw.loadJsonData("Data:NguhRoutes/network.json")
p.yes = function(frame)
-- Add error handling for JSON data
if data == nil then
return "Error: Failed to load JSON data from Data:NguhRoutes/network.json"
end
return mw.text.jsonEncode(data)
end
p.found = function(frame)
for i,j in pairs(data) do
if frame.args.code == i then
return j
end
end
return "Code "+frame.args.code+" not found"
end