Module:Testing
From RuneTails
Documentation for this module may be created at Module:Testing/doc
local p = {}
local categories = {
Fish = {
'Bass', 'Bass (Diamond)', 'Bass (Gold)', 'Bass (Jade)', 'Bass (Ruby)'
},
Vegetable = {
'Beetroot', 'Carrot', 'Cave Beetroot', 'Cave Carrot', 'Cave Daikon'
},
SmallVegetable = {
'Raddish', 'Spring Onion'
},
Berry = {
'Abyss Berry', 'Black Berry', 'Bliss Berry', 'Blue Berry', 'Brown Berry'
},
Mushroom = {
'Amber Peak', 'Aqua Polka-Dot Delight', 'Azure Whisper', 'Cloudy Pink Puff',
'Sunset Slimstalk', 'Wizard\'s Starry Hat' -- Original version (with apostrophe)
},
Flower = {
'Daisy'
},
Bug = {
'Bee', 'Caterpillar', 'Cicada', 'Glow Worm', 'Grub', 'Ladybug', 'Pill Bug',
'Spider', 'Tick', 'Worm'
}
}
-- Function to compare the page name with the Mushroom category
function p.compare_pagename_to_mushroom()
local pagename = mw.title.getCurrentTitle().text -- Fetch the current page name dynamically
local result = "PAGENAME: " .. pagename .. "\n" -- Prepare result string
local matchFound = false -- Flag to track if a match is found
result = result .. "Checking Mushroom Category Items:\n"
for _, mushroom in ipairs(categories.Mushroom) do
if pagename == mushroom then
matchFound = true
result = result .. "Match found: " .. mushroom .. "\n" -- If a match is found, show it
end
end
if not matchFound then
result = result .. "No match found for the page name in the Mushroom category.\n" -- If no match is found, show that
end
return result -- Return the result as a string
end
return p