Lua Code:
function Harvest.saveItem( nodeName, itemName, itemID )
if not Harvest.items.data[itemID] then
Harvest.items.data[itemID] = {}
table.insert( Harvest.items.data[itemID], { nodeName, itemName} )
if Harvest.settings.debug then
d("Item Data Saved!")
end
end
end
I completely got rid of Harvest.itemAlreadyFound() and consolidated it to this. My issue was that I was using "Harvest.nodes.data[itemID]" instead of "Harvest.items.data[itemID]"
Lua Code:
["items"] =
{
["data"] =
{
[27058] =
{
[1] =
{
[2] = [[Red Wheat]],
[1] = [[Barrels]],
},
},
[26976] =
{
[1] =
{
[1] = [[Barrels]],
[2] = [[Lard]],
},
},
},
["version"] = 2,
},
It is saving like that. My question is now, how do I reference that? Say I was going to print that out using d(Print something here). Would it be Harvest.items.data[itemID][1].1 or Would it be Harvest.items.data[itemID][1][1] and Harvest.items.data[itemID][1][2]. How do I reference the fields [1] and [2] to print or get at the node name and the item name of the given ItemID?