Fix Lua 5.0 getn() crash on first guide load

GuideTable.lua:88 used the Lua 5.0 global getn() to size the color-
substitution table opentext. In Lua 5.1 (WoW 3.3.5) the bare getn is
gone and table.getn is deprecated, so this would have crashed with
'attempt to call global getn (a nil value)' before any guide could
render. Replaced with the # length operator.

Also record the fix and the upstream README cleanup under 'Files we
touched' in README-CoA.md.
This commit is contained in:
2026-05-11 22:09:44 +02:00
parent d29ad39617
commit b96e1ce8b2
2 changed files with 10 additions and 1 deletions
+1 -1
View File
@@ -85,7 +85,7 @@ function objGuideTable:new(oSettings)
["replace"] = "|c00a80000" ["replace"] = "|c00a80000"
}, },
} }
for n = 1, getn(opentext) do for n = 1, #opentext do
t1[k1].items[k2].str = gsub(t1[k1].items[k2].str, opentext[n]["find"],opentext[n]["replace"]) t1[k1].items[k2].str = gsub(t1[k1].items[k2].str, opentext[n]["find"],opentext[n]["replace"])
end end
t1[k1].items[k2].str = gsub(t1[k1].items[k2].str, "#","|r") t1[k1].items[k2].str = gsub(t1[k1].items[k2].str, "#","|r")
+9
View File
@@ -27,6 +27,13 @@ have thrown `attempt to index global 'arg' (a nil value)` on every
debug call. Local-shadow `arg = {...}` keeps the rest of each function debug call. Local-shadow `arg = {...}` keeps the rest of each function
unchanged. unchanged.
**3. Lua 5.0 `getn` → length operator.** `GuideTable.lua` used the
Lua 5.0 global `getn(opentext)` to size a colour-substitution table.
That global is gone in Lua 5.1 (`table.getn` was deprecated and the
bare `getn` removed entirely). Replaced with `#opentext`. Would have
crashed on the very first guide load with
`attempt to call global 'getn' (a nil value)`.
What is still TODO What is still TODO
------------------ ------------------
@@ -57,6 +64,8 @@ Files we touched
- `VanillaGuide.toc` — Interface bump, CoA metadata. - `VanillaGuide.toc` — Interface bump, CoA metadata.
- `Core.lua` — local-shadow `arg = {...}` inside `Di` and `Dv`. - `Core.lua` — local-shadow `arg = {...}` inside `Di` and `Dv`.
- `GuideTable.lua``getn(opentext)``#opentext`.
- `README.md` — upstream Donations / volunteer-pitch section removed.
- `README-CoA.md` — this file. - `README-CoA.md` — this file.
Everything else is the unmodified 1.04.2 import. Everything else is the unmodified 1.04.2 import.