HaveItem() and RawGet() only take one table and one item as inputs, but the problem occurs when the given table isn't valid (some of its parent items doesn't exist).
Here's an example what I mean:
Code: Select all
table = {
list = {
{
sublist1 = {
{item = "bla"},
{item = "ble"}
},
sublist2 = {
{item = "bla2"},
{item = "ble2"}
}
},
{
sublist1 = {
{}
}
}
}
}
; Works
DebugPrint(HaveItem(table.list[0].sublist1[0], "item"))
DebugPrint(table.list[0].sublist1[0].item)
; Fails, any better way than check all items one by one in the table tree?
DebugPrint(HaveItem(table.list[1].sublist2[0], "item"))
For some reason even ExitOnError() doesn't seem to work in this case...
So, maybe some kind of extension to the HaveItem() or a whole new function for it? You get these kind of multi level tables all the time when dealing with JSON etc.