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 = { | ||
[" | ["s4, overworld"] = "SlabserverS4", | ||
[" | ["s3, overworld"] = "SlabserverS3", | ||
[" | ["s4, nether"] = "SlabserverS4_Nether", | ||
[" | ["s3, nether"] = "SlabserverS3_Nether" | ||
-- Add more mappings here as needed | -- Add more mappings here as needed | ||
} | } |
Revision as of 06:21, 15 October 2024
Documentation for this module may be created at Module:MapUrls/doc
local p = {}
-- Define the mapping between the inputs and URLs
local map = {
["s4, overworld"] = "SlabserverS4",
["s3, overworld"] = "SlabserverS3",
["s4, nether"] = "SlabserverS4_Nether",
["s3, nether"] = "SlabserverS3_Nether"
-- Add more mappings here as needed
}
-- Default function to generate the URL based on input parameters
function p.main(frame)
local server = frame.args.server: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 = server .. ", " .. 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