Module:Items: Difference between revisions

Added a check to allow for retrieving items with # in the name
(added 'buildItemGrid')
(Added a check to allow for retrieving items with # in the name)
Line 78: Line 78:
   name = string.gsub(name, "'", "'")
   name = string.gsub(name, "'", "'")
   for i, item in pairs(ItemData.Items) do
   for i, item in pairs(ItemData.Items) do
     if(item.name == name) then
    local itemName = string.gsub(item.name, '#', '')
     if(item.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 1,965: Line 1,966:
end
end


function p.buildItemGrid(frame)
function p.getItemGrid(frame)
   result = '{|'
   result = '{|'
   for i, item in Shared.skpairs(ItemData.Items) do
   for i, item in Shared.skpairs(ItemData.Items) do