local function get_all_blueprint_entities(blueprint_record)
local entities = {}
-- Check if the item is a blueprint book
if blueprint_record.type == "blueprint-book" then
-- Recursively process each item inside the book
for , item in pairs(blueprint_record.contents) do
local nested_entities = get_all_blueprint_entities(item)
for , nested_entity in pairs(nested_entities) do
table.insert(entities, nested_entity)
end
end
elseif blueprint_record.type == "blueprint" then
-- Add entities if it's a single blueprint
local blueprint_entities = blueprint_record.get_blueprint_entities()
if blueprint_entities then
for _, entity in pairs(blueprint_entities) do
table.insert(entities, entity)
end
end
end
return entities
end
But I am not able to create scenario when blueprint_record.type == "blueprint-book" but is also LuaItemStack