• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

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