Module
WorldSwitch
From Dogcraft Wiki
(mcmmo -> MCMMO; + hub) |
(Added sur6) |
||
Line 3: | Line 3: | ||
function p.subworld(frame) | function p.subworld(frame) | ||
input = mw.ustring.lower(frame.args[1] .. frame.args[2]) | input = mw.ustring.lower(frame.args[1] .. frame.args[2]) | ||
subworlds = {"husky", "beagle", "akita", "corgi", "labrador", "shepherd"} | subworlds = {"husky", "beagle", "akita", "corgi", "labrador", "shepherd", "sheltie", "retriever"} | ||
for key,value in ipairs(subworlds) do | for key,value in ipairs(subworlds) do | ||
if (mw.ustring.find(input, value, 1, true) ~= nil) then | if (mw.ustring.find(input, value, 1, true) ~= nil) then | ||
Line 14: | Line 14: | ||
function p.world(frame) | function p.world(frame) | ||
input = mw.ustring.lower(frame.args[1] .. frame.args[2]) | input = mw.ustring.lower(frame.args[1] .. frame.args[2]) | ||
worlds = {"survival 1", "survival 2", "survival 3", "survival 4", "survival 5", "creative", "patreon", "hub", "amplified", "MCMMO", "skyblock"} | worlds = {"survival 1", "survival 2", "survival 3", "survival 4", "survival 5", "survival 6", "creative", "patreon", "hub", "amplified", "MCMMO", "skyblock"} | ||
for key,value in ipairs(worlds) do | for key,value in ipairs(worlds) do | ||
if (mw.ustring.find(input, value, 1, true) ~= nil) then | if (mw.ustring.find(input, value, 1, true) ~= nil) then |
Revision as of 16:29, 20 December 2023
{{#invoke:WorldSwitch|subworld|Survial 4|Husky}}
generates: husky
{{#invoke:WorldSwitch|world|Survial 4|Husky}}
generates: survival 4
local p = {} --p stands for package
function p.subworld(frame)
input = mw.ustring.lower(frame.args[1] .. frame.args[2])
subworlds = {"husky", "beagle", "akita", "corgi", "labrador", "shepherd", "sheltie", "retriever"}
for key,value in ipairs(subworlds) do
if (mw.ustring.find(input, value, 1, true) ~= nil) then
return value
end
end
return ''--return 'not found'
end
function p.world(frame)
input = mw.ustring.lower(frame.args[1] .. frame.args[2])
worlds = {"survival 1", "survival 2", "survival 3", "survival 4", "survival 5", "survival 6", "creative", "patreon", "hub", "amplified", "MCMMO", "skyblock"}
for key,value in ipairs(worlds) do
if (mw.ustring.find(input, value, 1, true) ~= nil) then
return value
end
end
if (mw.ustring.find(input, 'survival', 1, true) ~= nil) then
return 'survival 1'
end
return ''--return 'not found'
end
return p
This page was last modified on 20 December 2023, at 16:29. (3 months ago)