Thread: LuaTexts
View Single Post
01-03-13, 01:53 AM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
I'm not familiar with how you actually enter things for LuaTexts tags, but these Lua snippets should get you started, and maybe someone else can explain how to get them into LuaTexts:

Inquisition seconds remaining on player
Code:
local _, _, _, _, _, duration, endTime = UnitBuff("player", "Inquisition")
if duration and endTime then
    return format("%d/%d", endTime - GetTime(), duration)
end
Censure stacks on target
Code:
local _, _, _, count = UnitDebuff("target", "Censure")
return count or 0
Remove the "or 0" part if you don't want to see a 0 when the target doesn't have Censure.

Shorter name text
I'm not sure what the included name tag is showing that's too long, or what length you consider "too long", but this will return "Name" for same-realm players, or "Name-Server" for cross-realm players, and cap the whole thing at 20 characters.
Code:
local name, realm = UnitName(unit)
if realm and strlen(realm) > 0 and realm ~= GetRealmName() then
     name = format("%s-%s", name, realm)
end
return strlen(name) > 20 and strsub(name, 1, 20) or name
This snippet will not do anything by itself, as the pink part ("unit") is a variable that needs to be set/renamed to work with LuaTexts.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote