Help with function interfaces.

Gwypaas

hook DoNothing MakeGUIUsersCrash
Reaction score
50
I've tried to make the user able to specify a function that runs on every timer interval but I'm having problems. If this function would work then "xxx = <value>","before evaluate", "after evaluate" and "create completed" should show up but I'm only able to see "create completed" and "before evaluate" so somehow the thread is crashing with my usage.



My code:
JASS:
library Shortened initializer Tester requires TT 

function Lol takes Shortened p returns Shortened
    call BJDebugMsg(&quot;xxx = &quot; + R2S(p.xxx))
    return p
endfunction

function interface USF takes Shortened p returns Shortened

struct Shortened
    real xxx
    USF usf
    
    static method Callback takes nothing returns boolean
        local Shortened p = TT_GetData()
        call BJDebugMsg(&quot;before evaluate&quot;)
        set p = p.usf.evaluate(p)
        call BJDebugMsg(&quot;after evaluate&quot;)
        return false
    endmethod
    
    static method create takes nothing returns Shortened
        local Shortened p = .allocate()
        set p.xxx = 1000
        
        set p.usf = Lol(p)
        
        call BJDebugMsg(&quot;create completed&quot;)
        return p
    endmethod
endstruct

private function Tester takes nothing returns nothing
    local Shortened p = Shortened.create()
    call TT_Start(function Shortened.Callback, p)
endfunction

endlibrary




EDIT - Solved.

I had to do
JASS:
set p.usf = USF.Lol
 
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