player.cursor_stack ~= nil always true?
Posted: Sat Jul 18, 2015 9:29 pm
Code: Select all
if player.cursor_stack ~= nil then
game.player.print(player.cursor_stack.name)
else
return
end
www.factorio.com
https://test.forums.factorio.com/
Code: Select all
if player.cursor_stack ~= nil then
game.player.print(player.cursor_stack.name)
else
return
end
if player.cursor_stack.valid_for_read then ...Changed LuaEntity::stack, LuaEntity::held_stack and LuaPlayer::cursor_stack to return LuaItemStack objects.
Changed LuaItemStack to allow reading any inventory slot even when the item in the slot is invalid. LuaItemStack::valid_for_read should be used before accessing the normal properties/methods for a given LuaItemStack.