#!/usr/bin/env python3 """Regenerate `reference/1.12-globals.tsv`: the 1.12.1 client's global namespace, by origin. WOW_RE=DIR scripts/gen-reference-globals.py [--wow-re DIR] [--out FILE] Each name in a capture of the running reference client's in-world `_G` gets one origin: lua Lua 5.0's own runtime, which mlua provides. engine the C client provides it; benilla implements these in Rust. framexml the shipped UI defines it (its Lua, its XML, or a `$parent`-composed child of one); it runs off the player's own patch chain, never hardcoded in Rust. Attribution is by definition site in the complete 1.12 shipped-UI corpus: - a name assigned or `function`-declared in shipped Lua, including Lua inside a FrameXML document, is FrameXML's; indented assignments count, because FrameXML leaks globals out of function bodies (`button = getglobal(...)`); - a `name="..."` on any shipped XML element is FrameXML's, `virtual="true"` included: a virtual `` is a real font object, and 1.12 registers named virtual frames too; - `` is a composed child (`ContainerFrame1Item16IconTexture`); - LUA_5_0 wins over all of these: FrameXML's `string = getglobal(...)` would otherwise claim the stdlib table. The inputs are the maintainer's analysis (`--wow-re` or `$WOW_RE`), not in this repo: the capture, the extracted FrameXML, and the install's MPQs. FrameXML alone is not the shipped UI: the twelve `Blizzard_*` addons live in the MPQs, and their `.lua` is reached through `