From 66c8e5a0b16332770e169ba10277bb12e84913c0 Mon Sep 17 00:00:00 2001 From: Brues <5278969+brues-code@users.noreply.github.com> Date: Mon, 22 Jun 2026 14:27:20 -0500 Subject: [PATCH] slash: write SLASH_* keys to _G inside module bodies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit pfUI module bodies run under pfUI.env (setfenv in LoadModule), which proxies reads to _G via __index but has no __newindex. Bare "SLASH_FOO = ..." assignments therefore land on pfUI.env, not on _G, and WoW's slash dispatcher reads _G.SLASH_* directly — so the slash command never registered. SlashCmdList[KEY] assignments happened to work because the table is read first (falls through), then the key write hits the real global table. /pfunitxp, /clickthrough, /ct, /disenchantall, /dea — all silently broken until now. Fixed by prefixing SLASH_* writes with _G. --- modules/nampower.lua | 4 ++-- modules/superwow.lua | 4 ++-- modules/unitxp.lua | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/nampower.lua b/modules/nampower.lua index ae28b02c..9aec86cc 100644 --- a/modules/nampower.lua +++ b/modules/nampower.lua @@ -150,8 +150,8 @@ pfUI:RegisterModule("nampower", function () -- /disenchantall slash command (DisenchantAll is Nampower-provided) if DisenchantAll then - SLASH_PFDISENCHANTALL1 = "/disenchantall" - SLASH_PFDISENCHANTALL2 = "/dea" + _G.SLASH_PFDISENCHANTALL1 = "/disenchantall" + _G.SLASH_PFDISENCHANTALL2 = "/dea" SlashCmdList["PFDISENCHANTALL"] = function() DisenchantAll() DEFAULT_CHAT_FRAME:AddMessage("|cff33ffccpfUI|r: Disenchanting all eligible items...") diff --git a/modules/superwow.lua b/modules/superwow.lua index 862e6ae0..9783e283 100644 --- a/modules/superwow.lua +++ b/modules/superwow.lua @@ -166,8 +166,8 @@ pfUI:RegisterModule("superwow", function () end -- Add slash command for clickthrough toggle - SLASH_PFCLICKTHROUGH1 = "/clickthrough" - SLASH_PFCLICKTHROUGH2 = "/ct" + _G.SLASH_PFCLICKTHROUGH1 = "/clickthrough" + _G.SLASH_PFCLICKTHROUGH2 = "/ct" SlashCmdList["PFCLICKTHROUGH"] = function() local enabled = pfUI.api.ToggleClickthrough() DEFAULT_CHAT_FRAME:AddMessage("|cff33ffccpfUI|r: Clickthrough mode " .. (enabled and "|cff00ff00enabled|r" or "|cffff0000disabled|r")) diff --git a/modules/unitxp.lua b/modules/unitxp.lua index aec2a90a..31b2639c 100644 --- a/modules/unitxp.lua +++ b/modules/unitxp.lua @@ -352,7 +352,7 @@ pfUI:RegisterModule("unitxp", function () end -- Debug command to test UnitXP indicators - SLASH_PFUNITXP1 = "/pfunitxp" + _G.SLASH_PFUNITXP1 = "/pfunitxp" SlashCmdList["PFUNITXP"] = function() local chat = DEFAULT_CHAT_FRAME chat:AddMessage("|cff33ffccpfUI|r: UnitXP Indicator Debug")