JASS: Returning an Integer

Status
Not open for further replies.
Level 2
Joined
Sep 8, 2008
Messages
15
function notreallyafunction takes nothing returns integer
return udg_IntegerVariable
endfunction

Ooh, look, now when you call that function, it gives you the variable IntegerVariable.

What I don't understand about this is when he says "it gives you the variable IntegerVariable"

What use could returning an integer have if it's global? Can someone give an example of this?
 
its like
set OMFGSOMETHING = notreallyafunction()
and OMFGSOMETHING becomes what notreallyafunction gives and it gives the value of IntegerVariable
 
Remember how in GUI you say something like:

  • Set AUnitVar = (triggering unit)
In jass this would be something like:
JASS:
local unit AUnitVar
set AUnitVar = GetTriggerUnit()

GetTriggerUnit takes nothing returns unit

in other words, it'll return a unit which can be assigned to a variable. Your own functions can also return variables you've used in your function.
 
Status
Not open for further replies.
Back
Top