• 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!

Comparisons with Table

Status
Not open for further replies.
Level 19
Joined
Aug 8, 2007
Messages
2,763
This is my line of code

JASS:
 if tree[forLoop][4+ ((NUM_OF_DATA + 1) * heroIndex)] > currentTalentPoints[playerId] then

tree[forLoop][...] returns an integer by Table's default. The error i get with this line is



Line ....: Relational comparission (this isnt my typo its a typo in the compiler lol) between special type and native type

i dont understand.. help? o.O (this is before JASShelper's conversion of structs into vanilla JASS)
 
Am i dreaming?? 2 pairs of brackets?

what is each one of the variables ? r they all integers ? and y r there 2 [] s ?
u have tree[][] ?

... seriously? learn2code

(yes its a TableArray)

If it's a struct instance rather than just an integer (yeah at the end it's the same but not for the vJass parser), then use integer()

It doesnt return a Table it returns an integer -_- but meh it worked by setting both values to an integer than comparing the seperate variables.
 
Then i suppose currentTalentPoints is not an integer array.
And i've never said to use integer variables but integer(), which is an explicit vJass typecast.

private integer array currentTalentPoints

i didnt know about that typecast though
 
You're wrong about TableArray :

JASS:
method operator [] takes integer key returns Table

So learn to read and be humble.

JASS:
if integer(tree[forLoop][4+ ((NUM_OF_DATA + 1) * heroIndex)]) > currentTalentPoints[playerId] then

Note that i have not checked if TableArray is meant to be used like that, i have never used it and i just don't care.
 
Afaik TableArray returns integer if not specified(table[].real[]) and I know it because both of my resources uses or they used to use them go some degree, but yes it is buggy the very same error happened to me a ehile ago and I had to use placeholder variable as well just as you had to,, it may be problem with JH
 
Well for "TableArray" i see the static method operator [] and the not static one [] mentionned above which returns Table, not an integer.
I mean it makes sense, it returns a Table in this example.

Now i could miss something but really i don't see what.

Also i know that struct instance <-> integer "typecast" is not well defined by Jasshelper, i mean when it's implicit or not, that's why sometimes it does work without an explicit typecast, and other times it doesn't.
 
Status
Not open for further replies.
Back
Top