[Twinsen][0.17.3] player.get_active_quick_bar_page is strange
Posted: Fri Mar 01, 2019 5:12 pm
At a minimum, this function seems under-documented, but it may be that some of its behavior constitutes a bug.
The function is given the index of a "screen page," and the documentation doesn't give a clear explanation of what this means. It appears to correspond to the (1-indexed) quick bar row that is visible on the screen. I would think, therefore, that the only meaningful values would be 1 or 2, but the function will happily accept larger values; the meaning of such values is unclear.
The function returns the 0-indexed quick bar page number, so that page 1 is 0, page 2 is 1, and so on up to page 0 being 9. This is confusing and seems inconsistent with the usual way in which Lua works; however, it is convenient when used in combination with player.get_quick_bar_slot, because you can compute an index with page * 10 + slot. Is this behavior intentional? Should the documentation spell this out explicitly?
Along the same lines, the documentation does not explain that player.get_quick_bar_slot and player.set_quick_bar_slot operate on indexes in the range 1 through 100. This is simple enough to determine through basic testing, but it seems like the sort of thing that should be spelled out explicitly.
The function is given the index of a "screen page," and the documentation doesn't give a clear explanation of what this means. It appears to correspond to the (1-indexed) quick bar row that is visible on the screen. I would think, therefore, that the only meaningful values would be 1 or 2, but the function will happily accept larger values; the meaning of such values is unclear.
The function returns the 0-indexed quick bar page number, so that page 1 is 0, page 2 is 1, and so on up to page 0 being 9. This is confusing and seems inconsistent with the usual way in which Lua works; however, it is convenient when used in combination with player.get_quick_bar_slot, because you can compute an index with page * 10 + slot. Is this behavior intentional? Should the documentation spell this out explicitly?
Along the same lines, the documentation does not explain that player.get_quick_bar_slot and player.set_quick_bar_slot operate on indexes in the range 1 through 100. This is simple enough to determine through basic testing, but it seems like the sort of thing that should be spelled out explicitly.