Editing Module:Infobox Item
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 66: | Line 66: | ||
local function findItem(name) | local function findItem(name) | ||
local lname = name:lower() | local lname = name:lower() | ||
− | |||
--Remove leading and trailing spaces. | --Remove leading and trailing spaces. | ||
lname = lname:gsub('^%s*(.-)%s*$', '%1') | lname = lname:gsub('^%s*(.-)%s*$', '%1') | ||
+ | |||
for key, item in pairs(p.loadData("item")) do | for key, item in pairs(p.loadData("item")) do | ||
− | if | + | if name == item['name']:lower() then |
return item | return item | ||
end | end | ||
Line 564: | Line 564: | ||
item = findItem(name) | item = findItem(name) | ||
− | + | ||
if item == 0 then | if item == 0 then | ||
return "<div style=\"color:red\"> No item named '" .. name .. "'</div>. The Module:Items/data maybe outdated." | return "<div style=\"color:red\"> No item named '" .. name .. "'</div>. The Module:Items/data maybe outdated." |