Code: Select all
local itemStack = robot.get_inventory(defines.inventory.robot_cargo)[1]
if itemStack and itemStack.valid then
if not player.can_insert(itemStack) then
player.print("full")
fish_market_temp_increase_inventory_bonus(player)
end
player.insert(itemStack)
end
If i let the c-robot repair something, it has nothing in the cargo stack: it crashes @ can_insert, while it should have been stopped at nil or .valid
Thank youError while running event level::on_gui_click (ID 1)
LuaItemStack API call when LuaItemStack was invalid.
stack traceback:
[C]: in function 'can_insert'
...temp/currently-playing/1337_toggle_personal_roboport.lua:83: in function 'remove_robots'
...temp/currently-playing/1337_toggle_personal_roboport.lua:133: in function 'update'
...temp/currently-playing/1337_toggle_personal_roboport.lua:153: in function 'toggle_personal_roboport_on_gui_click'
/home/sl/.factorio/temp/currently-playing/control.lua:92: in function </home/sl/.factorio/temp/currently-playing/control.lua:83>
note: I do know there is more than 1 inventory, not the point.