LuaItemStack was invalid
Posted: Fri Apr 22, 2016 10:36 pm
It's on my clipboard, might as well just ask... Homeworld crashes when the Seeder assembler thingy has no Tree Program input module in the inventory queue... It works as designed as long as there's one pending module (the first one is consumed to start the machine).
The code is:
The error is "LuaItemStack API call when LuaItemStack was invalid" right after "if inventory[1] then" ... so it would seem to need some kind of check of is_empty or something?
Thanks!
The code is:
Code: Select all
function Seeder:get_tree_type()
if self.state.entity.is_crafting() then
local inventory = self.state.entity.get_inventory(2)
if inventory[1] then
local tree_module = inventory[1].name
return config.tree_types[tree_module]
end
end
return nil
end
Thanks!