• 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.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

Dictionary data structure

Status
Not open for further replies.
Level 15
Joined
Aug 7, 2013
Messages
1,342
Hi,

Is there a library for mapping arbitrary values/handles to other arbitrary values/handles (like a Python Dictionary). I've got the Table library but not sure if it do this.

e.g.

JASS:
Dictionary d
local button b
local dialog d
set d[b] = d
//now we have mapped this specific button to that specific dialog
//so if I call d[b] I will get back that dialog instance d
d == d[b] //returns true

How could I use Table to do this?
 
Level 18
Joined
Sep 14, 2012
Messages
3,413
There is something you might like in the JASS section : http://www.hiveworkshop.com/forums/submissions-414/system-dictionary-212593/

After you can use Table too.
JASS:
globals
    Table tb //Don't forget to do tb = Table.create() in an init function
endglobals

function MyFunc takes nothing returns nothing
    local button b
    ...
    set tb.button[GetHandleid(b)] = b
    b = tb.button[GetHandleId(b)]
    //Clean leaks if necessary ....
endfunction
 
Status
Not open for further replies.
Top