[Solved] Odd return from item.subgroup
Posted: Wed Jul 26, 2017 6:27 am
I'm trying to find all the items with the subgroup "raw-resource" by using item.subgroup as seen on the lua api, but did not get the strings I was looking for:
That was what I received as the subgroup for the wooden chest.
Here is the code I used:
Should item.subgroup as used in this example give me the subgroup in the form of "raw-resource" assuming raw-resource was its subgroup?
The code is in control.lua and the result was printed to a label on the screen as a caption using this ( table.tostring() and its requirements) to turn the table to a string.
That was what I received as the subgroup for the wooden chest.
Here is the code I used:
Code: Select all
for __, item in pairs(game.item_prototypes) do
if not item.has_flag("hidden") then--and item.subgroup == "raw-resource" then
table.insert(raw, {item.name, item.subgroup})
end
end
The code is in control.lua and the result was printed to a label on the screen as a caption using this ( table.tostring() and its requirements) to turn the table to a string.