| 07-20-2005, 05:28 AM | #1 |
What exactly would a "local handle" be? Realising that a handle is actually a variable type, does this mean you can set any handle subvariables to a handle variable? |
| 07-20-2005, 08:03 AM | #2 |
Handlers are normal variables.you cannot hve subvars or other stuff,just the difference that the Local Handle Variables can be any OBJECT in game, like units,effects,groups etc,but no integer,reals. here is a link to a tutorial for the Local Handle Variables by KaTTaNa http://www.wc3jass.com/viewtopic.php?t=2006 and if you want to learn Jass come to this site www.wc3jass.com it's great,belive me! |
| 07-20-2005, 10:10 PM | #3 |
I know jass quite well. I just hadn't cleared the thought that a handle variable could be any of its subtypes (unit, loc etc) |
| 07-20-2005, 11:13 PM | #4 | |
Quote:
they should be able to be subtypes. yay inheritance. at least worth trying it. |
| 07-20-2005, 11:25 PM | #5 |
God, I need a JASS tutor. You wanna teach me ed? I'll give you some rep. ![]() |
| 07-20-2005, 11:44 PM | #6 |
Think of Java's Object type. This is jass's handle. Completely worthless in jass, but if you want to make a generic data collection class it might be interesting to use a handle, instead of a H2I converting the handle to an int. Don't think about C/C++ Handles as jass's are simmilar but C is far more complicated then jass. |
| 07-21-2005, 01:47 AM | #7 |
so what are you saying? |
| 07-21-2005, 03:44 AM | #8 |
its the class from which all other objects inherit. In Java to make a generic data collection its good to use Object, because it can take every type of object, and you can use a type cast statement when returning it. In Jass, its completely worthless, because its faster to just use integers and only do a single H2I conversion. |
| 07-21-2005, 11:57 AM | #9 |
But then if a handle variable could be a unit, loc, group etc, then why not allways use handle. |
| 07-21-2005, 12:23 PM | #10 |
U can use unit function with handle parameters, handle != unit, but its the same type. |
| 07-21-2005, 03:06 PM | #11 |
because you can't pass handle to a unit taking function. Just like Java you can't pass object to a string taking function. Even though technically the handle could be a unit, and the object could be a string. For the function to recognize this fact you have to typecast the object/handle to the subtype it requests. As I said before because of this Jass's handle is pretty worthless, because we can just integer as its faster because we need to use less typecasting. |
| 07-21-2005, 03:33 PM | #12 | |
Quote:
Handle requires more memory, this is like sayin "why not always use real numbers instead of integers" 101 |
| 07-21-2005, 10:10 PM | #13 |
I'm referring to the pointer. You can store the pointer as an integer or as a handle, its irrelevant because in both cases it still takes 4 bytes. The object exists regardless and is of a size I don't perticularly know and is variable anyway. |
| 07-23-2005, 01:10 PM | #14 | |
Quote:
A handle is an object that you would probably call "abstract" in oop. |
| 07-23-2005, 05:55 PM | #15 |
handle is the ancestor type of widget, and some other types like timer, trigger, and all of those. widget is the ancestor of unit, item and destructable. Every other type I didn't mention in this post and it is not code, integer , real, string or boolean . Is an descendant from handle too. and since unit is a descendant of widget it is a descendant of handle. Descendant as in when you have a function that takes handle you can use any type that is a descendant from it. |
