More actions
GamingTwist (talk | contribs) No edit summary |
GamingTwist (talk | contribs) No edit summary |
||
Line 3: | Line 3: | ||
-- Define the mapping between the inputs and URLs | -- Define the mapping between the inputs and URLs | ||
local map = { | local map = { | ||
[" | ["SurvivalS4, overworld"] = "map.slabserver.org?world=SlabserverS4", | ||
[" | ["SurvivalS4, nether"] = "map.slabserver.org?world=SlabserverS4_Nether", | ||
[" | ["SurvivalS3, overworld"] = "s3map.slabserver.org?world=SlabserverS3", | ||
[" | ["SurvivalS3, nether"] = "s3map.slabserver.org?world=SlabserverS3_Nether", | ||
[" | ["SurvivalS2, overworld"] = "s2map.slabserver.org?world=Slabserver%20Prelease", | ||
[" | ["SurvivalS2, nether"] = "s2map.slabserver.org?world=Slabserver%20Prelease_Nether" | ||
} | } | ||
-- Default function to generate the URL based on input parameters | -- Default function to generate the URL based on input parameters | ||
function p.main(frame) | function p.main(frame) | ||
local | local season = frame.args.season:lower() -- E.g., S4, S3, etc. | ||
local world = frame.args.world:lower() -- E.g., Overworld, Nether | local world = frame.args.world:lower() -- E.g., Overworld, Nether | ||
-- Build the key based on the inputs | -- Build the key based on the inputs | ||
local key = | local key = season .. ", " .. world | ||
-- Lookup the URL in the map | -- Lookup the URL in the map |
Revision as of 07:54, 8 December 2024
Documentation for this module may be created at Module:MapUrls/doc
local p = {}
-- Define the mapping between the inputs and URLs
local map = {
["SurvivalS4, overworld"] = "map.slabserver.org?world=SlabserverS4",
["SurvivalS4, nether"] = "map.slabserver.org?world=SlabserverS4_Nether",
["SurvivalS3, overworld"] = "s3map.slabserver.org?world=SlabserverS3",
["SurvivalS3, nether"] = "s3map.slabserver.org?world=SlabserverS3_Nether",
["SurvivalS2, overworld"] = "s2map.slabserver.org?world=Slabserver%20Prelease",
["SurvivalS2, nether"] = "s2map.slabserver.org?world=Slabserver%20Prelease_Nether"
}
-- Default function to generate the URL based on input parameters
function p.main(frame)
local season = frame.args.season:lower() -- E.g., S4, S3, etc.
local world = frame.args.world:lower() -- E.g., Overworld, Nether
-- Build the key based on the inputs
local key = season .. ", " .. world
-- Lookup the URL in the map
local url = map[key]
-- Return the URL or a default value if no match is found
if url then
return url
else
return "map_error"
end
end
-- Return a table, with `main` as the default function
return p