What's new
  • Visit Rebornbuddy
  • Visit Resources
  • Visit API Documentation
  • Visit Downloads
  • Visit Portal
  • Visit Panda Profiles
  • Visit LLamamMagic

[LUA] Error while trying to return a Lua-Value

Stormchasing

Community Developer
Joined
Jan 15, 2011
Messages
4,029
Reaction score
46
Hi,

i've a little problem.
While i test to fix a rangebug in one of the CCs i'm modifing i get this error
System.NullReferenceException: Object reference not set to an instance of an object.
at Styx.WoWInternals.Lua.GetReturnVal[T](String lua, UInt32 retVal)

The Code is:
PHP:
isInRange = (Lua.GetReturnVal<int>(String.Format("return IsSpellInRange(\"{0}\",target)",spell.Name), 0) == 1);

And i can't figure out the problem.
The Toon has a target to check the cast, the spell is right too, but it throws an error.
Printing the result in the wow client with, does work well
PHP:
/script print(IsSpellInRange("Shadow Bolt",target)); // replace the spell with something u r able to use

And NO, it is not an option to try the built-in property distance from the wowunit, this returns no useable values (Ultraxion, Madness of Deathwing, Warlord Zon'Ozz hardmode)
 
Last edited:
why are you using lua? SpellManger.CanCast includes range checks and its much faster and safer then using lua.
 
it is not an option to try the built-in property distance from the wowunit, this returns no useable values (Ultraxion, Madness of Deathwing, Warlord Zon'Ozz hardmode)
same for cancast ... both returns wrong values in this fights
 
As far as i know, then you need to have "target" (or in HB \"target\") - works for me
 
As far as i know, then you need to have "target" (or in HB \"target\") - works for me
are u sure this has to be escaped?
okay this could explain it, it shouldn't do any difference if i use target or unit in this case, i'll try that.
Thank u


---- edit ---
thank u very much, this does the trick :)
now i'll test it this evening on the encounters where i had the range problems
 
Last edited:
Back
Top