Module:Palindromic item names
Jump to navigation
Jump to search
Documentation
No documentation subpage exists yet for this module. Create one now.
local items = require('Module:Iteminfo').info
local itemnames = require('Module:ItemNames').getData
return {
go = function(frame)
local palindromes = {}
-- iterate over all items and add palindromes to the list
for id = items.IDs.min, items.IDs.max do
local itemname = itemnames('itemNameFromId', id) or ''
if itemname ~= '' and string.lower(itemname) == string.lower(string.reverse(itemname)) then
table.insert(palindromes, itemname)
end
end
-- format the item names as a list of links
for i = 1, #palindromes do
palindromes[i] = '* [[' .. palindromes[i] .. ']]'
end
-- output
return table.concat(palindromes, '\n')
end,
}