problem whit type code

dudeim

New Member
Reaction score
22
You can do this (think this is what you want atleast)

JASS:

function a takes nothing returns nothing
//do things
endfunction

function b takes nothing returns nothing
call a()
endfunction


Note that function a can't call function b as a function you call has to be above the other function
 

themean

Active Member
Reaction score
7
PurgeandFire's
tanks man that work i dont know why :D
but still stands problem calling code type
JASS:

code f
call f()
 

saw792

Is known to say things. That is all.
Reaction score
280
You can't call a code type, you have to execute it with a trigger. That's just the way it is.
 

themean

Active Member
Reaction score
7
just i need full info for how i can use type code
i need to give function like parameter to other function
but jass is not c++
and i have some problems
 

Jesus4Lyf

Good Idea™
Reaction score
397
JASS:
function Call takes code takesNothingReturnsNothing returns nothing
    local trigger t=CreateTrigger()
    local triggeraction ta=TriggerAddAction(t,takesNothingReturnsNothing)
    call TriggerExecute(t)
    call TriggerRemoveAction(t,ta)
    call DestroyTrigger(t)
    set t=null
    set ta=null
endfunction
function Evaluate takes code takesNothingReturnsBoolean returns boolean
    local trigger t=CreateTrigger()
    local boolean b
    call TriggerAddCondition(t,Filter(takesNothingReturnsBoolean))
    set b=TriggerEvaluate(t)
    call DestroyTrigger(t)
    set t=null
    return b
endfunction

These are the only way to call code variables. It is not possible to directly call a code variable. They are used in Filters, and they are used in trigger actions. There are some other places they are used.

For more power, like what you seem to want, see function interfaces in the vJass manual.

Example of above code:
JASS:
function func1 takes code func2 returns nothing
call Execute(func2)
endfunction

JASS:
function func1 takes code func2 returns nothing
local trigger t = CreateTrigger() // you forgot create trigger.
call TriggerAddAction( t, func2 ) 
endfunction

JASS:
function k takes nothing returns nothing
code z=function ma
call Execute(z)
endfunction

JASS:
function x takes nothing returns boolean
    return false
endfunction
function y takes nothing returns boolean
    local code f=function x
    return Evaluate(f)
endfunction
 

Zwiebelchen

You can change this now in User CP.
Reaction score
60
It works, but these two functions make no practical sense if you ask me, as you can not (at least I don't know how) 'attach' functions to other variables, which would be the only practical use of this. [ljass]code[/ljass] is, unfortunately, not a 'full' data type.
 

Narks

Vastly intelligent whale-like being from the stars
Reaction score
90
with scissors



isn't there a list of all the natives that break threads
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
I suppose you want mean "how open a new thread ?"
ExecuteFunc (evil, really, don't use it) , TriggerExecute,TriggerEvaluate.

And with vJass .execute,.evaluate, which in fact execute/evaluate a trigger.

Care about .evaluate with methods though.
Because of that.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top