mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 08:00:42 +00:00
Fixes #41. LunaUnitFrames sets SetupGroupHeader(groupType) as its group headers' OnEvent while also calling it directly with a group name. As a handler it relies on groupType being nil so it falls back to this.unitGroup. Our modern script arguments hand it `self` instead, so it looks the header up by frame rather than by name, gets nothing, and indexes nil at units.lua:358. The addon is correct vanilla code. A function that is both called directly and used as a script handler is an ordinary vanilla idiom, and passing positional arguments to handlers breaks it wherever the first parameter means something other than self. Adds CAPI_VanillaScriptArgsCompat(frame, script), which rewraps one handler in a no-parameter closure so the extra arguments stop there and the original runs with the empty argument list it was written for. The globals survive the nesting, so it still reads `this` and `event`. Same shape as the existing CAPI_MouseoverClearedCompat. Only the group headers need it. SetupRaidHeader takes the header frame itself, so `self` is already the value it wants. This covers one addon, not the class. Any addon using the same idiom hits the same failure, and each will need its own entry here until handlers opt in to modern arguments rather than receiving them unconditionally.