HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

quick GetSpellTargetLoc() question

10-26-2008, 07:15 AM#1
zen87
Selection A
Collapse JASS:
 local location l = GetSpellTargetLoc()
 local real x = GetLocationX(l)
 local real y = GetLocationY(l)
    call RemoveLocation(l)
    set l=null


Selection B
Collapse JASS:
 local real x = GetLocationX( GetSpellTargetLoc())
 local real y = GetLocationY( GetSpellTargetLoc())

A, or B?

p/s: yeah yeah I know it has been asked for thousand times... but i just cant dig out the old answer in the search... +rep for the 1st answer~
10-26-2008, 07:16 AM#2
Tide-Arc Ephemera
I'd go with A. I do that when I make spells 'n' stuff.

EDIT!
Also, it doesn't leak.
10-26-2008, 07:19 AM#3
zen87
how ya know B is leaking...?
10-26-2008, 07:22 AM#4
grim001
Or you could use EventTargetLib.
10-26-2008, 07:26 AM#5
zen87
implementing a whole system just for a tiny spell ain't worth it -_-
10-26-2008, 07:47 AM#6
Tide-Arc Ephemera
Quote:
Originally Posted by zen87
how ya know B is leaking...?
It's built in knowledge from my GUI days. Though, now that I think about it - it probably doesn't... but still, force of habit when I code.
10-26-2008, 08:15 AM#7
zen87
that's exactly what i'm wondering... 5 lines and 2 lines... of course we want our code look more neat isn't it...
10-26-2008, 09:10 AM#8
Troll-Brain
It leaks and that's easy to test.
So if you manage about leaks you should use the A.
10-26-2008, 09:37 AM#9
grim001
Quote:
Originally Posted by zen87
implementing a whole system just for a tiny spell ain't worth it -_-

It's more useful if you're making a map filled with spells that would each save 5 or 10 lines of code.
10-26-2008, 10:38 AM#10
zen87
well just want the code looks more neat...

basically GetSpellTargetLoc() = creating a new location and return it?
10-26-2008, 10:50 AM#11
Troll-Brain
yes it do
10-26-2008, 11:39 AM#12
zen87
okays thanks guys, +reps