Code: Select all
-- blueprint-book. Item 1,2 and 8 real blueprint
local cursor_stack = player.cursor_stack
-- Active Item in Book. Get blueprint: "item_active[1]"
local item_active = cursor_stack.get_inventory(defines.inventory.item_active)
-- Stored Items in Book. Get blueprint: "item_main[1..30]"
local item_main = cursor_stack.get_inventory(defines.inventory.item_main)
-- Real blueprint`s in Book (without active)
local Count = item_main.get_item_count("blueprint")
-- Size of Book, default 30
local Size = #item_main
item_main[1].valid -- Ok
item_main[1].label -- Ok
item_main[2].valid -- Ok
item_main[2].label -- Ok
item_main[3].valid -- Ok
item_main[3].label -- Error: "LuaItemStack API call when LuaItemStack was invalid."
-- How check!?
--
item_main[8].valid -- Ok
item_main[8].label -- Ok
All 30 elements return true for checking "item_main [2] .valid"
Elements 1,2 and 8 are LuaItemStack, you can call the "name", "label", etc.
All other elements generate an error when calling "LuaItemStack API call when LuaItemStack was invalid."