/Tukui/modules/chat/telltarget.lua
Lua | 21 lines | 19 code | 1 blank | 1 comment | 7 complexity | c5c0d97668efb1b279307f08e401392d MD5 | raw file
- local T, C, L = unpack(select(2, ...)) -- Import: T - functions, constants, variables; C - config; L - locales
- if C["chat"].enable ~= true then return end
- -- /tt - tell your current target.
- for i = 1, NUM_CHAT_WINDOWS do
- local editBox = _G["ChatFrame"..i.."EditBox"]
- editBox:HookScript("OnTextChanged", function(self)
- local text = self:GetText()
- if text:len() < 5 then
- if text:sub(1, 4) == "/tt " then
- local unitname, realm
- unitname, realm = UnitName("target")
- if unitname then unitname = gsub(unitname, " ", "") end
- if unitname and not UnitIsSameServer("player", "target") then
- unitname = unitname .. "-" .. gsub(realm, " ", "")
- end
- ChatFrame_SendTell((unitname or L.chat_invalidtarget), ChatFrame1)
- end
- end
- end)
- end