Im trying to add an custom function from another profile to my profile.So i added this code
Code:
function repli.Disarm()
for i=1, #ArenaTars do
if UnitExists(ArenaTars[i])
and UnitIsPlayer(ArenaTars[i])
and UnitCanAttack("player",ArenaTars[i])
and UnitPowerMax(ArenaTars[i]) < 200000
and cdRemains(676) == 0
and shouldDisarm(ArenaTars[i]) ~= nil
and rangeCheck(78,ArenaTars[i])
then
CustomTarget = ArenaTars[i]
CastSpellByName(GetSpellInfo(676),CustomTarget)
end
end
return false
end
Into mine functions.lua and at the end of file i added ProbablyEngine.library.register("repli", repli)
Inside rotaation i added
Code:
{"676", { --Disarm
"@repli.Disarm()",
}},
And what happens when i hit target i get lua error and addon doesnt work
Code:
Message: [string "local target = "target";return ProbablyEngi..."]:1: attempt to index field 'repli' (a nil value)
Time: 01/18/15 13:27:29
Count: 7
Stack: [C]: ?
[string "local target = "target";return ProbablyEngi..."]:1: in function `func'
Interface\AddOns\Probably\system\core\library.lua:34: in function `parse'
Interface\AddOns\Probably\system\core\parser.lua:166: in function `nested'
Interface\AddOns\Probably\system\core\parser.lua:234: in function `table'
Interface\AddOns\Probably\system\timers\rotation.lua:31: in function `cycle'
Interface\AddOns\Probably\system\timers\rotation.lua:79: in function `event'
Interface\AddOns\Probably\system\core\timer.lua:16: in function <Interface\AddOns\Probably\system\core\timer.lua:11>
I also tried using "function cutie.Disarm()" as thats which rotation im actually using, but again it crashes with same error.
Can anyone explain me what im doing wrong and how to add an custom function properly?