ui: define TurtleWoW's sizeof so Transmog/Shop windows do not raise on nil
This commit is contained in:
@@ -397,6 +397,24 @@ do
|
||||
local trimmed = _gsub(str, "^%s*(.-)%s*$", "%1")
|
||||
return trimmed
|
||||
end
|
||||
|
||||
-- `sizeof(t)`: TurtleWoW's `Globals.lua:111` table-entry count. Its patched FrameXML uses it
|
||||
-- wherever a list's length is wanted — `Turtle_TransmogUI.lua:677` counts
|
||||
-- `AvailableTransmogItems[InventorySlotId]`, its `TransmogOutfits` pages, `OptionsFrame.lua`
|
||||
-- the arena-team rows, and `Blizzard_BindingUI` the search results. 1.12 has no such name
|
||||
-- (`reference/1.12-globals.tsv` is silent and no stock file calls it); the exception list in
|
||||
-- `tests/reference_surface.rs` carries the same reason. The body is the reference's verbatim:
|
||||
-- a non-table is 0, and `pairs` counts every key, hash and array.
|
||||
function sizeof(t)
|
||||
if type(t) ~= "table" then
|
||||
return 0
|
||||
end
|
||||
local s = 0
|
||||
for k in pairs(t) do
|
||||
s = s + 1
|
||||
end
|
||||
return s
|
||||
end
|
||||
end
|
||||
|
||||
-- ── NOT here: tostringall / strconcat / strtrim ────────────────────────────────────────────────
|
||||
|
||||
@@ -43,6 +43,11 @@ fn allowed_beyond_1_12() -> HashSet<&'static str> {
|
||||
"strsplit",
|
||||
"strjoin",
|
||||
"trim",
|
||||
// TurtleWoW's `Globals.lua:111` table-entry count, which its patched FrameXML calls for
|
||||
// every list length (Turtle_TransmogUI's available-items/outfits, the guild bank, arena
|
||||
// rows, binding search). `sizeof` is not 1.12's name and the exception is its `Globals.lua`
|
||||
// ship — same reason the four above.
|
||||
"sizeof",
|
||||
// TurtleWoW's addon-message split and delimiters: its `HonorFrame.lua:46` and
|
||||
// `WorldStateFrame.lua:233-335` parse the `TW_HONOR`/`TW_BG` addon payloads with them.
|
||||
"explode",
|
||||
|
||||
Reference in New Issue
Block a user