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

Saving unto hash

Status
Not open for further replies.
There is a way to save directly:
JASS:
native  SaveAgentHandle                    takes hashtable table, integer parentKey, integer childKey, agent whichAgent returns boolean
That should work for most handles that you need to save, since you mostly save agents anyway.

There is also another means of saving a general handle, through:
JASS:
function SaveHandle takes hashtable table, integer parentKey, integer childKey, handle h returns boolean
    return SaveFogStateHandle(table, parentKey, childKey, ConvertFogState(GetHandleId(h)))
endfunction
Taken from: http://www.thehelper.net/threads/handle.137692/

However, it requires a different loading method. Also, for both methods, you need to know what type you are trying to load if you want to load it. This is because saving an loading in a hashtable is actually a form of typecasting. There isn't a way to typecast to handle (can't typecast to agent either), iirc, so you need to load it as something else.

Here is a link you might want to look into:
http://www.thehelper.net/threads/typecasting.121176/

Although, more importantly, what do you need this for? I'm sure there is a workaround. :)
 
So,i need to follow what Bribe did? ouch

I saw both links a day ago,and i never thought such thing works.

Thanks for the help. + rep :D

edit

I'll spread first before i do it XD

edit
The thing is that,you can't load agents XD.

My plan is to create a mini-table for GUIers and JASSers,but i dont want to type so many so i have to think a way to save/load datas quickly
 
Last edited:
All i need the method is saving. Loading will be perhaps will use CnP functions(because textmacros doesn't exist)
You can use textmacros then to create the functions. There's no reason why not to use textmacros except if you want people to use it with vanilla editor, which makes no sense because everyone is using newgen nowadays.

Im going to use such thing in a minitable.
That didn't answer my question. My question was: what's the practical advantage of your table over the ordinary tables?

You can use the ConvertFogState workaround to store handles to a hashtable.
 
Status
Not open for further replies.
Top