expected returns struct

Discussion in 'JASS Zone' started by Azureus, Sep 28, 2016.

  1. Azureus

    Azureus New Member

    Ratings:
    +0 / 0 / -0
    If anyone there still developing maps or just came around the Warcraft Zone.
    Here is the question. I have a buff system using struct and hashtable, I found that quite efficient in terms of performance. But JassHelper would just say expected "Returns" pointing on that piece of code^
    JASS:
    function saveHash takes buffStr returns nothing
    SaveInteger(udg_buffTable,GetHandleId(.u),.ba,buffStr)
    endfunction

    Here is a whole code for reference
    JASS:
    struct buffStr
    unit u
    timer t
    real dur
    integer ba //buffAbility
    
    static method create takes unit whichUnit, real howLong, integer buffAbility returns buffStr
    
    local buffStr bs = buffStr.allocate()
    set bs.u = whichUnit
    set bs.t = CreateTimer()
    set bs.ba = buffAbility
    set bs.dur = howLong
    call TimerStart(bs.t,howLong,false,function removeBuff)
    
    return bs
    endmethod
    
    endstruct
    
    function saveHash takes buffStr returns nothing
    SaveInteger(udg_buffTable,GetHandleId(.u),.ba,buffStr)
    endfunction
     
  2. Tyrulan

    Tyrulan Ultra Cool Member

    Ratings:
    +37 / 0 / -0
    Your endstruct should encapsulate the saveHash function as well.
     
  3. jonas

    jonas Well-Known Member

    Ratings:
    +42 / 4 / -0
    Code:
    function saveHash takes buffStr s returns nothing
        call SaveInteger(udg_buffTable,GetHandleId(s.u),s.ba,buffStr)
    endfunction
    
     
  4. Azureus

    Azureus New Member

    Ratings:
    +0 / 0 / -0
    Wow guys. Thanks a lot for you replies. It is now all sorted out. Thanks again!
     

Share This Page