HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

going mad.. Local Vars. / Global Vars. ???

11-19-2004, 09:50 PM#1
oNdizZ
can someone try to explain, very detailed, what Local variables and Global variables are and the difference between them?

plz really wanna know :D
11-19-2004, 10:57 PM#2
AFB-DieHard
local variables are deleted after the function ends(JASS), global variables can be used in the whole map
11-20-2004, 11:23 AM#3
iNfraNe
Quote:
Originally Posted by AFB-DieHard
local variables are deleted after the function ends(JASS), global variables can be used in the whole map
like he said, local variables "stay" inside the function. No outside function can change them and they are created on function run which means you can have as many of the same variable as you want. Locals are esspecially handy when u make triggered spells with waits, cuz the "Casting Unit" changes after the wait. You can use a local unit to store the casting unit and use him after the wait

hope that was clear!

oh btw, globals can be used everywhere and can be changed byevery function.
11-20-2004, 12:21 PM#4
Vexorian
You can always use Triggering Unit instead of casting unit, the problem lies with the target event responses
11-20-2004, 03:18 PM#5
iNfraNe
Quote:
Originally Posted by Lord Vexorian
You can always use Triggering Unit instead of casting unit, the problem lies with the target event responses
I prefer locals :P it feels more... "safe"