• 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 faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

Locals

Status
Not open for further replies.
Level 10
Joined
Aug 19, 2008
Messages
491
You can't declare locals in MUI. MUI just describes if something can be used by everyone without bugs.
However in Jass you can declare a local variable that can only be accessed by that perticular function.
Like so:
JASS:
function SomeFunction takes integer my_int returns boolean
    local boolean b = true
    local unit some_name = GetTriggerUnit()
    local integer i
    set i = my_int //The function has taken my_int as an argument, look in the function decleration
                   //In this case, my_int is 1 since SomeOtherFunction (below) passed on 1 to this function
    return b //the funcion wanted to return a boolean, so here we do it
endfunction

function SomeOtherFunction takes nothing returns nothing
    call SomeFunction(1)
endfunction

//In general you type "local [type] [name] = [value]" where "= [value]" is optional
 
Status
Not open for further replies.
Top