Well, I figured out that my lua script wasn't working as a spell, but if I used it as a condition then it worked. Now I'm trying to pass "t" to another 'spell', with the below as a condition:
<LuaScript>-- Find the unit with the largest health deficit, in range, that is alive, that doesn't have Rejuvenation
print("t ",t)
m=0;
w=f;
local SpellName = GetSpellInfo("Rejuvenation")
for i=nps,npe do
if i==0 then
tt="player"
else
tt=t..i
end;
if UnitExists(tt) and IsSpellInRange(SpellName,tt) and not UnitIsDeadOrGhost(tt) and not UnitBuff(tt,SpellName,nil,"PLAYER") then
a=UnitHealth(tt) / UnitHealthMax(tt);
if a>m then
m=a w=tt
end
end
end;
-- Heal the unit with the largest deficit
if m <= .95 then
CastSpellByName(SpellName, w)
end
</LuaScript>
I get nothing, not print, not any action, etc. Suggestions?