All types except integer, real, boolean, string and code are handles. For example:
local unit u = GetTriggerUnit()
local handle h = u // Legal: All units are handles
set u = h // Illegal: Not all handles are units
The advantage of handles is that any object can be referenced assigned to a handle. It can be inverted with a function like this:
function HandleToUnit takes handle h returns unit
return h
return null
endfunction
function HandleToInt takes handle h returns integer
return h
return 0
endfunction
The HandleToInt function is great because you can get a unique integer representation for any object that way.
You can completely avoid the type handle. It has no value by itself. But on the other hand every unit, group, force, ... are actually handles since those types are derived from handle. The only use I know of is using it with return bug functions so you do not need one for every type.
i dont know exactly but i think u can use handlevars to have them as "local vars" between several fuctions because "normal" local vars work in only one