Thanks for the update, the mod seems to work fine now! As for the problem reported above, my non-expert guess is, that a nil check must be made for the entire address, since the minable or result property below it could be removed by another mod (they are both optional properties according to docs).
A standard function I like to use (for the sake of compactness), is this:
function address_exists(t, ...)
for i = 1, select("#", ...) do
if t == nil then return false end
t = t[select(i, ...)]
end
return true
end
An implementation would then look like this:
local t = data.raw.tree
for _, value in pairs(t) do
if address_exists(minable, "result") and value.minable.result == "wood" then
[code]
end
end
end
Which should at least prevent a crash. Pardon the unsolicited advice, just really wanted to share! The function is very useful for deep tables. [Edit: Fixed code and explanation above]