olety / cjass

Preserving cjass code from code.google.com/p/cjass
0 stars 0 forks source link

Does automatic flush locals require adicparser be enabled? #20

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
struct tester extends array
    private static method getUnit takes nothing returns unit
        local unit u=CreateUnit(Player(0),'hpea',0,0,0)
        local unit b=u
        call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,"Handle Id: "+I2S(GetHandleId(u)))
        return u
    endmethod
    private static method r takes nothing returns nothing
        call RemoveUnit(getUnit())
    endmethod
    private static method onInit takes nothing returns nothing
        call TimerStart(CreateTimer(),3,true,function thistype.r)
    endmethod
endstruct

to

function s__tester_getUnit takes nothing returns unit
local unit u=CreateUnit(Player(0),'hpea',0,0,0)
local unit b=u
call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,"Handle 
Id:"+I2S(GetHandleId(u)))
return u
endfunction
function s__tester_r takes nothing returns nothing
call RemoveUnit(s__tester_getUnit())
endfunction
function s__tester_onInit takes nothing returns nothing
call TimerStart(CreateTimer(),3,true,function s__tester_r)
endfunction

Original issue reported on code.google.com by mrasolo...@gmail.com on 12 Aug 2011 at 4:25

GoogleCodeExporter commented 9 years ago
> Does automatic flush locals require adicparser be enabled?
Yes, also make sure "Locals auto flush" form cJass menu are checked.

{{{
// with
function s__tester_getUnit takes nothing returns unit
    local unit u=CreateUnit(Player(0),0x68706561,0,0,0)
    local unit b=u
    call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,"Handle Id: "+I2S(GetHandleId(u)))
    set cj_v666_unit=u
    set b=null
    set u=null
    return cj_v666_unit
endfunction
// without
function s__tester_getUnit takes nothing returns unit
    local unit u=CreateUnit(Player(0),0x68706561,0,0,0)
    local unit b=u
    call DisplayTimedTextToPlayer(GetLocalPlayer(),0,0,60,"Handle Id: "+I2S(GetHandleId(u)))
    return u
endfunction
}}}

Original comment by adi...@gmail.com on 12 Aug 2011 at 8:33

GoogleCodeExporter commented 9 years ago
Autoflush works well.

Original comment by adi...@gmail.com on 15 Aug 2011 at 4:42