Locals

Status
Not open for further replies.
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.
Back
Top