|
|
| Line 1: |
Line 1: |
| local p = {}; | | local p = {}; |
| local data = mw.loadJsonData("Data:ItemData.json") | | local data = mw.loadJsonData("Data:ItemData.json") |
| local dataDataData = mw.loadJsonData("Module:Sandbox/Sylphoid/data")
| |
|
| |
|
| -- returns the table of a specific item | | -- returns the table of a specific item |
| Line 75: |
Line 74: |
|
| |
|
| return Format(cost) | | return Format(cost) |
| end
| |
|
| |
|
| |
| -- returns the table of a specific item
| |
| function get_json_item2(name)
| |
| for i,v in pairs(dataDataData) do
| |
| if (v["Name"] == name) then
| |
| return v
| |
| end
| |
| end
| |
| return nil
| |
| end
| |
|
| |
| --{{#invoke:Sandbox/Sylphoid|get_prop2|ITEM_NAME|PROPERTY}}--
| |
| --check Data:ItemData.json for properties
| |
| p.get_prop2 = function(frame)
| |
| local shopTableValues = {}
| |
| local item_name = frame.args[1]
| |
| local property = frame.args[2]
| |
| local item = get_json_item2(item_name)
| |
| if(item == nil) then return "Item Not Found" end
| |
| if(type(item[property]) == "table") then
| |
| for i,v in pairs(item[property]) do
| |
| local shopTableValues = table.insert(shopTableValues, v)
| |
| --local tableValues = get_json_item(item)
| |
| end
| |
| return table.concat(shopTableValues, ", ")
| |
| end
| |
| return item[property]
| |
| --return tableValues[property]
| |
| end | | end |
|
| |
|