Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
function b takes unit u returns nothing
endfunction
function a takes nothing returns nothing
local unit u = GetTriggerUnit()
call b(u)
set u = null
endfunction
There are 2 different unit u.
In function a, there is unit u, which points to GetTriggerUnit().
That pointer is sent to function b.
In function b, there is another unit u, which points to the same GetTriggerUnit().
So if you mean, are they both the same unit? then yes.
If you mean, are they the same variable? then no.
If you do this, you still displays the name twice:
JASS:
function b takes unit u returns nothing
call BJDebugMsg("unit name = " + GetUnitName(u))
set u = null
endfunction
function a takes nothing returns nothing
local unit u = GetTriggerUnit()
call b(u)
call BJDebugMsg("unit name = " + GetUnitName(u))
set u = null
endfunction
EDIT:
On the other hand...
this is function b:
JASS:
function b
local unit u = GetParameter(1)
(set u = null)
endfunction
So yea you can use unit u, but it is a local varaible of function b.
the difference is that it is a parameter and parameters are automatically nulled at end. (that is something of JASS compiler)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.