Page 1 of 1

[.15.9] luaItemStack.active_index using 0 based index

Posted: Mon May 08, 2017 6:33 pm
by Nexela
Holding a BP book with a few BPs in it with the first bp as the active bp and running this command results in inventory out of bounds error, adding 1 to the active index returns the correct index
/c game.print(game.player.cursor_stack.get_inventory(defines.inventory.item_main)[game.player.cursor_stack.active_index].name)

Re: [.15.9] luaItemStack.active_index using 0 based index

Posted: Mon May 08, 2017 6:47 pm
by Rseding91
This seems to be a recurring problem :D We develop with 0-based indexing and then forget to convert to 1-based for the API.

Anyway, fixed for 0.15.10.