| 05-04-2008, 08:57 PM | #1 |
I'm working on an AI script (not the real AI script, I'm making AI directly inside the map script), I need to enumerate all items in range and call a function for each of them. But since I can have several AI players on the map, I need the callback function to be able to determine which player's AI function is being executed. I do not know how threads work in jass, but is it safe to use a global for that? |
| 05-04-2008, 09:59 PM | #2 |
Using a global should be safe, unless the code executed in the callback could in some way trigger another enumeration, but even then, if you store the previous value of the global variable to a local one before doing the enumeration and set the global to the value of that local variable after the enumeration finishes you should be safe. |
| 05-05-2008, 06:26 AM | #3 |
you can always use the vJASS object functions |
