1.12's table library is `n`-based end to end: `insert` and `remove` write a size through
`luaL_setn` (`0x6f4ea0`) and `getn` (`0x6f5050`) reads it back, so a table emptied behind the
library's back still answers the size the last insert left. That is faithful, and on either real
client it is also harmless, because something always resets it.
Ace2 is what makes this client the exception. Dewdrop-2.0 and Tablet-2.0 decide which Lua they are
on by *compiling* a grammar probe, then pick a *library* call from the answer:
local lua51 = loadstring("return function(...) return ... end") and true or false
local table_setn = lua51 and function() end or table.setn
5.0 cannot compile `function(...)`, so it keeps calling `setn`; a real 5.1 has no remembered size
to reset, because `getn` is `#`. Here the parser takes 5.1's grammar while the table library is
still 5.0's, so the probe says 5.1, `table_setn` becomes a no-op, and the one thing that reset the
size is gone.
`Dewdrop:FeedAceOptionsTable` recycles a single `values` table between calls: it empties it with
`for k in pairs(values) do values[k] = nil end` -- raw sets this layer never sees -- then reads
`table.getn(values)` and gets the count the previous menu's inserts left. It drains that phantom
count with `table.remove`, descends `options.args[nil]`, and returns having added no lines. The
first dropdown of a session is right and every one after it opens as an empty 180x20 box. Seven
copies of that library head ship across BigWigs, AuldLangSyne, SuperAPI, NampowerSettings and
shootyepgp, and AceLibrary serves whichever one won arbitration, so patching a copy fixes nothing
reliably.
So the deviation that was already here for growth now covers shrinking too: a size this layer
*derived* from an insert or a remove is a cache, and it is stale once the slot it ended on is gone
as well as once the table has grown past it. A size an addon *declared* with `table.setn` is still
honoured exactly as 5.0 honours it -- that is what `setn(t, 0)` is for -- and a hole in the middle
still keeps the size, because 5.0 keeps it.
Measured in the client with ~100 addons loaded: `table.getn` after insert-then-clear answers 0
rather than 3, a hole at index 2 of five still answers 5, a declared 3 survives the clear, and the
guild hub's shootyepgp options menu opens with its 18 lines on the first click and on every click
after it. 2145 benilla-ui tests pass; benilla-app's 12 reds are the pre-existing data goldens,
identical with and without this change.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SgstFWtn1RxEJ5kVrpgYwn