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

Undeclared Variable this

Status
Not open for further replies.
Level 19
Joined
Aug 8, 2007
Messages
2,765
Heres the line of code

JASS:
struct i2i
    private hashtable Hash = InitHashtable()
    static method convert takes integer currentItemId returns integer
        return LoadInteger(Hash, currentItemId, 0)
    endmethod
    private static method add takes integer itemIdFirst, integer itemIdSecond returns nothing
        call SaveInteger(Hash, itemIdFirst, 0, itemIdSecond)
        call SaveInteger(Hash, itemIdSecond, 0, itemIdFirst)
    endmethod
    private static method onInit takes nothing returns nothing
        call i2i.add(0, 0)
    endmethod
endstruct

(whereever it uses the hashtable variable Hash returns the error)

and when compiled it comes out to

JASS:
       return LoadInteger(s__i2i_Hash[this], currentItemId, 0)

whatd i do wrong lol
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
No, in the current state it makes what i said.
That's the cause of the error, since Hash is a not static struct member, it expects <structInstance>.Hash
With a static member, only one hashtable will be created in the globals variables definitions.
And he should use "thistype.Hash" then.

Btw, the limit of the hashtables is 256, if you reach it, no more hashtable is created, like gamecaches.
 
Status
Not open for further replies.
Top