Module:Station: Difference between revisions

From Nguhcraft Wiki
Jump to navigation Jump to search
Biangfox (talk | contribs)
No edit summary
Biangfox (talk | contribs)
No edit summary
Line 9: Line 9:
         return "Error: Failed to load JSON data from Data:NguhRoutes/network.json"
         return "Error: Failed to load JSON data from Data:NguhRoutes/network.json"
     end
     end
     return data
     return mw.text.jsonEncode(data)
end
end


-- CRITICAL: You must return the module table
-- CRITICAL: You must return the module table
return p
return p

Revision as of 23:01, 8 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

-- CRITICAL: You must return the module table
return p