• 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!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

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?
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
its like
set OMFGSOMETHING = notreallyafunction()
and OMFGSOMETHING becomes what notreallyafunction gives and it gives the value of IntegerVariable
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
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.
Top