takes integer array ul?

Vulcansurge

Ultra Cool Member
Reaction score
27
is it possible to have a function that take an integer array?

Code:
function UpgradeItemLoop takes integer l, integer ut, item i, integer array ul, player p, integer array uc, unit u, item iu returns nothing

This gives a syntax error in jasscraft... is there another way to add an array?
 

Vulcansurge

Ultra Cool Member
Reaction score
27
oh ok.. thanks.

dont know much about structs. can you give me a link to a tutorial? +REP
 
Reaction score
333
oh ok.. thanks.

dont know much about structs. can you give me a link to a tutorial? +REP

Well, Vexorian wrote a tutorial on structs in vJass. It can be found here. Its a bit confusing though. There is also the manual.

You can declare arrays in structs like this:

JASS:
struct UpgradeItemArrays
    integer array ul[6] //The [6] means the array will be size 6
    integer array uc[6]
endstruct


JASS:
function UpgradeItemLoop takes integer l, integer ut, item i, UpgradeItemArrays st, player p, unit u, item iu returns nothing
    local integer zz = st.ul[3] //Here the ul array inside the struct is being used.
endfunction


You must create/destroy a struct before/after use.
 

PurgeandFire

zxcvmkgdfg
Reaction score
508
Why would you need it to take an array in the first place? Just make it take the type, eg:
JASS:
function DoFartStuff takes unit u, string msg, string anim returns nothing
    call BJDebugMsg(msg)
    call SetUnitAbilityLevel(u,'A000',70)
    call SetUnitAnimation(u,anim)
    call DoNothing()
endfunction

function JASS takes nothing returns nothing
    local unit array u
    local string array s
    set u[1] = GetTriggerUnit()
    set s[1] = "Fart Stuff Activated!"
    set s[2] = "stand"
    call DoFartStuff(u[1],s[1],s[2])
    set u[1] = null
endfunction


It does the same thing. :)
 
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