Function Return

w00t22

CSS L4D DoD? Steam ID = w00t22
Reaction score
43
I dont get in jass in functions when you say return r. say r is an integer. what gets the return value? where is it? what is it called now?

i just dont get where the returned values go
 
D

Dino.pl

Guest
if you have a function
Code:
function myFunc takes nothing returns integer
return 5
endfunction
and you use it this way
Code:
set var = myFunc()
integer var will be set to 5
 

w00t22

CSS L4D DoD? Steam ID = w00t22
Reaction score
43
set var = myFunc()

this is in another function?

if so i get it know and thanks alot
 

emjlr3

Change can be a good thing
Reaction score
395
if its in ur custom script it can be used anywhere, else it is limited to that trigger alone, as long as it is above the function u call it in

another example

Code:
function blah takes unit u return real
    return GetUnitState(u,UNIT_STATE_LIFE)
endfunction

this takes a unit and tells you what its life is in a real value

thus you would use something like

Code:
local unit u = GetTriggerUnit()
local real r = blah(u)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top