• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

???

Status
Not open for further replies.
Level 5
Joined
Oct 15, 2009
Messages
136
Could someone explain this to me please?

JASS:
function Init takes nothing returns nothing
    set x[0] = 50
    set x[50] = 25
    set x[25] = 75
    set x[75] = 100
    set x[x[x[x[x[0]]]]] = 95
    call PrintInt(x[100])
endfunction

What's the meaning of arrays variables having indexes as arrays variables?
 
The index of an array is an integer. It can be any statement that returns an integer.

In this case, as the array is an integer array, its own elements can be used as an index to an element.

In this example, when the game runs it it will evaluate like this....
set x[x[x[x[x[0]]]]] = 95
get value at x[0]
set x[x[x[x[50]]]] = 95
get value at x[50]
set x[x[x[25]]] = 95
get value at x[25]
set x[x[75]] = 95
get value at x[75]
set x[100] = 95
Make value at x[100] become 95

Other valid indecies are '0000' formated integers and function calls.
 
Status
Not open for further replies.
Back
Top