This site works best with JavaScript enabled. Please enable JavaScript to get the best experience from this site.
Hey, I'm trying to truncate player names to 6 characters in my Raid frames. I created a custom tag, but I don't know if it's the best way to accomplish my goal:
function(unit, unitOwner) return string.sub(UnitName(unitOwner), 1, 6)end
This works fine when I use it for some frames, such as the Player frame. However, when I try to use it for Raid frames, I get the following Lua error:
Message: [string "return function(unit, unitOwner)..."]:2: bad argument #1 to 'sub' (string expected, got nil)Time: Tue Jun 1 15:23:36 2021Count: 1Stack: [string "return function(unit, unitOwner)..."]:2: bad argument #1 to 'sub' (string expected, got nil)[string "=(tail call)"]: ?[string "=[C]"]: in function `sub'[string "return function(unit, unitOwner)return string.sub(UnitName(unitOwner), 1, 6)end"]:2: in function `func'[string "@Interface\AddOns\ShadowedUnitFrames\modules\tags.lua"]:232: in function `UpdateTags'[string "@Interface\AddOns\ShadowedUnitFrames\modules\layout.lua"]:447: in function `InitFontString'[string "@Interface\AddOns\ShadowedUnitFrames\modules\layout.lua"]:469: in function `SetupText'[string "@Interface\AddOns\ShadowedUnitFrames\modules\layout.lua"]:144: in function `Load'[string "@Interface\AddOns\ShadowedUnitFrames\modules\layout.lua"]:106: in function `Reload'[string "@Interface\AddOns\ShadowedUF_Options\config.lua"]:219: in function <Interface\AddOns\ShadowedUF_Options\config.lua:213>[string "@Interface\AddOns\ShadowedUF_Options\config.lua"]:1935: in function <Interface\AddOns\ShadowedUF_Options\config.lua:1877>[string "=[C]"]: ?[string "@Interface\AddOns\Ace3\AceConfig-3.0\AceConfigDialog-3.0\AceConfigDialog-3.0.lua"]:51: in function <...nfig-3.0\AceConfigDialog-3.0\AceConfigDialog-3.0.lua:49>[string "@Interface\AddOns\Ace3\AceConfig-3.0\AceConfigDialog-3.0\AceConfigDialog-3.0.lua"]:847: in function <...nfig-3.0\AceConfigDialog-3.0\AceConfigDialog-3.0.lua:668>[string "=[C]"]: ?[string "@Interface\AddOns\Ace3\AceGUI-3.0\AceGUI-3.0.lua"]:72: in function <Interface\AddOns\Ace3\AceGUI-3.0\AceGUI-3.0.lua:70>[string "@Interface\AddOns\Ace3\AceGUI-3.0\AceGUI-3.0.lua"]:306: in function `Fire'[string "@Interface\AddOns\Ace3\AceGUI-3.0\widgets\AceGUIWidget-CheckBox.lua"]:68: in function <...ns\Ace3\AceGUI-3.0\widgets\AceGUIWidget-CheckBox.lua:57>
Locals: <none>
If I unlock frames at this point, then the addon gets very buggy. Some frames (Raid frames always, sometimes Party frames) appear in their unlocked states, even if I try to lock/unlock all frames. If I close the Options window, I can't re-open it with any of the slash commands. I guess there's something wrong with how I wrote the function, or with some way it interacts with Raid frames.
To post a comment, please login or register a new account.