Azlier
Old World Ghost
- Reaction score
- 461
You guys remember the now broken CodeVar right? Right.
This does everything that CodeVar could do except for returning the function originally passed to it. Isn't that magical?
Also contains a silly userData integer for you to use.
Note that desyncs may happen to Mac users should you use .evaluate on a function not returning a boolean.
This can be used like vJass' function interfaces without the arguments. I also predict it to be faster, really.
This does everything that CodeVar could do except for returning the function originally passed to it. Isn't that magical?
Also contains a silly userData integer for you to use.
Note that desyncs may happen to Mac users should you use .evaluate on a function not returning a boolean.
JASS:
struct Code
private static hashtable HT = InitHashtable()
private trigger T = CreateTrigger()
private static boolexpr B
private static thistype D1
private static thistype D2
integer userData
static method get takes code c returns thistype
set .B = Filter(c)
set .D1 = GetHandleId(.B)
set .D2 = LoadInteger(.HT, .D1, 0)
if .D2 == 0 then
set .D2 = thistype.allocate()
call TriggerAddAction(.D2.T, c)
call TriggerAddCondition(.D2.T, .B)
call SaveInteger(.HT, .D1, 0, .D2)
endif
return .D2
endmethod
method execute takes nothing returns nothing
call TriggerExecute(.T)
endmethod
method evaluate takes nothing returns boolean
return TriggerEvaluate(.T)
endmethod
endstruct
This can be used like vJass' function interfaces without the arguments. I also predict it to be faster, really.