Re-registers the standard five entries (create / resume / yield /
status / wrap) on the global `coroutine` table. The C-level
machinery (lua_resume, lua_yield, lua_newthread, threads as tag 8)
was always linked into the engine; only the script-side library
was stripped from the registration tables at build time.
Two WoW-specific quirks discovered along the way and worked
around:
- `lua_resume` returns 1 for BOTH yield and caught runtime error.
Disambiguated by checking `co->ci > co->base_ci` — a yielded
coroutine still has its body frame on the call stack; an
errored one has been unwound to base_ci.
- The byte at L+0x31 is `allowhook` (saved/restored around
protected calls), not `L->status` as it initially looked.
Status reading is replaced by the ci comparison above.
Registers `SetEquipmentSet` on the GameTooltip method registry,
mirroring the 4.3.4 implementation at 0x0046E690. Builds a tooltip
with header + counts (equipped / in inventory / ignored) + one line
per missing item.
Storage format now persists itemID alongside GUID per slot
(`slot N guid=0xHEX item=ID`), so missing items can be looked up by
name in the item cache even when the live CGItem is no longer in the
client's object map. Backward compat: pre-itemID files load fine and
fall back to a `%d missing` summary line for those slots.
Adds `Game::Lua::PushLocalizedString` and `PushLocalizedFormatInt`
helpers — generic lookup of `_G[name]` with a C-string fallback for
servers stripped of standard GlobalStrings. The tooltip uses these
for the four count lines via Blizzard's `ITEMS_VARIABLE_QUANTITY`,
`ITEMS_EQUIPPED`, `ITEMS_IN_INVENTORY`, `ITEM_SLOTS_IGNORED` keys,
and for the per-missing-item line via `ITEM_MISSING`.
AddOn side: a `GlobalStrings.lua` companion provides English defaults
for those five keys plus a `ShowEquipmentSet()` test helper in
Constants.lua.
First implementation passed `nargs=4` to `lua_call` where the stack
needed 5 (self + text + r + g + b for `tooltip:SetText`) — Lua then
treated `self` as the function, surfacing as
`<in C code>: in function 'SetEquipmentSet'` with no Lua frame above.
Fixed before this commit.
Module-self-registration pattern for the glue Lua state, mirroring the
existing in-game ModuleAutoRegister. Modules opt in with a file-scope
GlueModuleAutoRegister; the hook on FUN_0046ABB0 (master glue init,
single caller, 35-byte linear function) fires their callbacks after
the engine finishes registering its own 109 glue functions onto the
freshly-created glue state.
Prior attempt hooked the inner FUN_0046DDF0 60-fn batch trampoline and
crashed on Octo, likely from sibling-DLL collision on a small target.
The linear caller is larger and less obvious; no crash, hook fires
cleanly on initial launch and every world->glue return.
Three sites were doing the same 3-call (PushString + PushNumber + SetTable
on GLOBALS_INDEX) to declare integer globals. Promote to a shared helper
that uses RawSet (globals have no __newindex in vanilla 1.12, so the
metatable check SetTable does is dead).
Also lift CLASSIC_API_VERSION out of DllMain.cpp into api/Version.cpp
so it self-registers via ModuleAutoRegister like every other Lua surface,
instead of being a special case wired into FrameScript_Initialize_h.