Lua Docs Inventory.getbar - misleading description

This subforum contains all the issues which we already resolved.
wvlad
Fast Inserter
Fast Inserter
Posts: 217
Joined: Thu Jul 13, 2017 9:55 pm
Contact:

Lua Docs Inventory.getbar - misleading description

Post by wvlad »

Assuming indexes in lua start from 1.
getbar() → uint
Get the current bar. This is the index at which the red area starts.
When I called setbar(1) it set 1 slot free and others locked. Which means that when I call getbar() it will return 1 but red area will actually start from index 2. So getbar() returns the index before the red area starts.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14265
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Lua Docs Inventory.getbar - misleading description

Post by Rseding91 »

Thanks for the report. The description is correct just it was using zero-based indexing instead of lua 1-based.

To set 1 slot free you would use setbar(2) so the bar starts at the begining of slot #2. to set no slots free you would start the bar at slot 1.

I've fixed it for the next version of 0.16. so it uses 1-based indexing.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Resolved Problems and Bugs”