Module:ItemTables: Difference between revisions

m quick fix for wrong name
setup initial search crawl
Line 77: Line 77:


p.itemPropTable = function(frame)
p.itemPropTable = function(frame)
local shopTableValues = {}
local TableValues = {}
local item_name = frame.args[1]
local listofItems = ""
local property = frame.args[2]
local property = frame.args[1]
local item = get_json_item(item_name)
-- local item = get_json_item(item_name)
if(item == nil) then return "Item Not Found" end
-- if(item == nil) then return "Item Not Found what" end
for i,v in pairs(data) do
for internalName, statName in pairs(data) do --statName is the key. go through whole table. in this case itemName can be upgrade_improved_stamina
if(type(item[property]) == "table") then
for i,v in pairs(item[property]) do
if(statName[property] ~= nil) then
if(v == property) then
listofItems = listofItems .. statName["Name"] .. "<br/>"
shopTableValues = table.insert(shopTableValues, item["Name"])
-- TableValues = table.insert(TableValues, statName["Name"]) -- i may want to make a table first, so it includes weapon and cost to make it sortable.
end
end
end
return table.concat(shopTableValues, ", ")
end
end
end
return listofItems
return item[property]
--return table.concat(TableValues, ", ")
--for i,v in pairs(data) do
-- if(type(item[property]) == "table") then
-- for i,v in pairs(item[property]) do
-- if(v == property) then
-- TableValues = table.insert(TableValues, item["Name"])
-- end
-- end
-- return table.concat(TableValues, ", ")
-- end
--end
--return item[property]
--return tableValues[property]
--return tableValues[property]
end
end


return p
return p