More actions
GamingTwist (talk | contribs) Created page with "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 -- E.g., S4, S3, etc. local world = frame.args.world --..." |
GamingTwist (talk | contribs) No edit summary |
||
Line 11: | Line 11: | ||
-- Default function to generate the URL based on input parameters | -- Default function to generate the URL based on input parameters | ||
function p. | function p.main(frame) | ||
local server = frame.args.server -- E.g., S4, S3, etc. | local server = frame.args.server -- E.g., S4, S3, etc. | ||
local world = frame.args.world -- E.g., Overworld, Nether | local world = frame.args.world -- E.g., Overworld, Nether | ||
Line 29: | Line 29: | ||
end | end | ||
-- | -- Return a table, with `main` as the default function | ||
return p | return p |
Revision as of 05:42, 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 -- E.g., S4, S3, etc.
local world = frame.args.world -- 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 "Unknown server/world combination"
end
end
-- Return a table, with `main` as the default function
return p