Module:Items: Difference between revisions

Fixed typo with last edit
(Added a check to allow for retrieving items with # in the name)
(Fixed typo with last edit)
Line 79: Line 79:
   for i, item in pairs(ItemData.Items) do
   for i, item in pairs(ItemData.Items) do
     local itemName = string.gsub(item.name, '#', '')
     local itemName = string.gsub(item.name, '#', '')
     if(item.name == itemName) then
     if(name == itemName) then
       result = Shared.clone(item)
       result = Shared.clone(item)
       --Make sure every item has an id, and account for Lua being 1-index
       --Make sure every item has an id, and account for Lua being 1-index
Line 735: Line 735:
   end
   end
   if addCategories then result = result..table.concat(categoryArray, '') end
   if addCategories then result = result..table.concat(categoryArray, '') end
   return result
   return resultf
end
end