From b96e1ce8b25dbe9716004eff14e447daf1442818 Mon Sep 17 00:00:00 2001 From: Florian Berthold Date: Mon, 11 May 2026 22:09:44 +0200 Subject: [PATCH] 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. --- GuideTable.lua | 2 +- README-CoA.md | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/GuideTable.lua b/GuideTable.lua index 0f4bfe8..95d0ef2 100644 --- a/GuideTable.lua +++ b/GuideTable.lua @@ -85,7 +85,7 @@ function objGuideTable:new(oSettings) ["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"]) end t1[k1].items[k2].str = gsub(t1[k1].items[k2].str, "#","|r") diff --git a/README-CoA.md b/README-CoA.md index 6279906..2f18cc8 100644 --- a/README-CoA.md +++ b/README-CoA.md @@ -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 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 ------------------ @@ -57,6 +64,8 @@ Files we touched - `VanillaGuide.toc` — Interface bump, CoA metadata. - `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. Everything else is the unmodified 1.04.2 import.