HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

variable for function

02-14-2005, 07:18 PM#1
Tabris
Hi!!
I have read someone that there is variable for function, can someone tell me how it works?
Thanks

(synthaxe, how store and use the function....)
02-16-2005, 10:25 PM#2
weaaddar
local code c=function myFunction

This cannot take parameters and can not even be executed. It can be used with the TimerStart, The ForGroup/Force/item/destructable, trigger action, boolexpr though.
If I remember correctly you can not declare a code array. I have no idea why and I don't really see a reason why you'd want an array of functions...

Alternatively you can just the execfunc thing that takes a string of the name of the function and will execute that.
02-17-2005, 01:41 PM#3
Tabris
Thanks

but i wanted a more positiv answer...
^_^
02-17-2005, 02:55 PM#4
Vexorian
I think you can declare a code array in blizzard.j

anyways you can execute a code variable if you create a trigger with that as action and then Execute the trigger, but it is completelly worthless, really

Just use ExecuteFunc, it takes strings, and you can always make string variables or arrays.

Only thing about ExecuteFunc is that it uses another thread, it can be good or bad depending on what you are doing
02-17-2005, 03:31 PM#5
Tabris
ok thanks
but I don't anything about thread...
For me the word "thread" only have a meaning in forum....
^_^
If you could explain I thank you.

I need this because i am doing a reflect magic shield.
So i make a function fire for all spell taking firingUnit and TargetUnit and if TargetUnit has this shield firingUnit and Targeting unit are switch. And that is for all all spell, so I thinks that pass the name of the functionspell with a String will work...
thanks
But what about thread?
Do I have to be afraid? ^_^
02-17-2005, 03:47 PM#6
Vexorian
I didn't know a word about this threads thing when I was starting to use JASS.

A thread It is a separated zone of execution, if you have a wait in a thread, other threads won't do that wait .

For example each time you execute a trigger it uses another thread, if you do this:

Trigger A
Actions:
Game - Text Message : Executed
Wait (5)
Game - Text Message : 5 minutes elapsed


Trigger B
Actions:
Game Text MEssage : Executing
Trigger Run Trigger A
Game Text MEssage : Finished Executing


It would show this in game:

Executing
Executed
Finished Executing
5 minutes elapsed.

See? The second trigger didn't consider the wait that was called in the first trigger
02-17-2005, 04:59 PM#7
Tabris
I see
Do we have to bother about the number of thread?