• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Comparisons with Table

Status
Not open for further replies.
Level 19
Joined
Aug 8, 2007
Messages
2,765
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)
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
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.
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
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.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
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
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
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.
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
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
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
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.
Top