ds_map_mirror
/*
** Usage:
** ds_map_mirror(dsid)
**
** Arguments:
** dsid ds_map data structure for which
** keys and values will be swapped
**
** Returns:
** nothing
**
** GMLscripts.com
*/
{
var dsid,temp,key,val;
dsid = argument0;
temp = ds_map_create();
key = ds_map_find_first(dsid);
val = ds_map_find_value(dsid,key);
ds_map_add(temp,val,key);
repeat (ds_map_size(dsid)-1) {
key = ds_map_find_next(dsid,key);
val = ds_map_find_value(dsid,key);
ds_map_add(temp,val,key);
}
ds_map_copy(dsid,temp);
ds_map_destroy(temp);
}
** Usage:
** ds_map_mirror(dsid)
**
** Arguments:
** dsid ds_map data structure for which
** keys and values will be swapped
**
** Returns:
** nothing
**
** GMLscripts.com
*/
{
var dsid,temp,key,val;
dsid = argument0;
temp = ds_map_create();
key = ds_map_find_first(dsid);
val = ds_map_find_value(dsid,key);
ds_map_add(temp,val,key);
repeat (ds_map_size(dsid)-1) {
key = ds_map_find_next(dsid,key);
val = ds_map_find_value(dsid,key);
ds_map_add(temp,val,key);
}
ds_map_copy(dsid,temp);
ds_map_destroy(temp);
}
[Please Login]
Projects: 4
Contributor: Leif902
comments powered by Disqus

Related: