Originally Posted by Phanx
Can you post the whole code you're using? Line 4 in the code I posted doesn't refer to "myLang" at all.
(I also updated my last post with corrected code, so you may want to just copy/paste it again.)
|
Ah, that was due to a comment line that was added when the .lua was created with the addon creator tool.
I just copy and pasted this into the lua file from your first post in this thread:
Code:
local myLang, _, _, myTimezone = select(5, LibStub("LibRealmInfo"):GetRealmInfo(GetRealmName()))
myLang = myTimezone == "AEST" and "AU" or myLang:sub(3)
hooksecurefunc("LFGListSearchEntry_Update", function(self)
local leaderName = select(13, C_LFGList.GetSearchResultInfo(self.resultID))
local realmName = leaderName and leaderName:match("%-(.+)")
if realmName then
local realmLang, _, _, realmTimezone = select(5, LibStub("LibRealmInfo"):GetRealmInfo(realmName))
realmLang = realmTimezone == "AEST" and "AU" or realmLang:sub(3)
if realmLang and realmLang ~= myLang then
self.ActivityName:SetFormattedText("%s[%s]|r %s", ORANGE_FONT_COLOR_CODE, realmLang:sub(3), self.ActivityName:GetText())
end
end
end)
And this is the error after doing that:
Code:
1x RegionInfo\code.lua:2: attempt to index local 'myLang' (a nil value)
RegionInfo\code.lua:2: in main chunk
Locals:
myLang = nil
_ = nil
_ = nil
myTimezone = nil
(*temporary) = "Bleeding Hollow"
(*temporary) = nil
(*temporary) = <function> defined @LibRealmInfo\LibRealmInfo.lua:21
(*temporary) = "attempt to index local 'myLang' (a nil value)"