[0.18.19] Return value from spill_item_stack errors
Posted: Tue Apr 21, 2020 6:21 pm
I can't figure out how to get the return values from LuaSurface.spill_item_stack.
These spill all the mags as expected...
but having both an optional parameter and a return variable gives "attempt to index a boolean" error ???
Attached is simple addon to repeat the issue - just start a new game and plop a stone-furnace or something down - mags will spill.
Mine the furnace and error will happen.
These spill all the mags as expected...
Code: Select all
-- This spills mags and fills 'spilled' with the array of 50 entities as expected..
local spilled = player.surface.spill_item_stack(
player.position,
{ name = "firearm-magazine", count = 50 }
)
-- This spills mags as expected (but no return obviously)
player.surface.spill_item_stack(
player.position,
{ name = "firearm-magazine", count = 50 },
true
)
Code: Select all
local badspill = player.surface.spill_item_stack(
player.position,
{ name = "firearm-magazine", count = 50 },
true
)
Mine the furnace and error will happen.