Skip to content

Instantly share code, notes, and snippets.

@headswe
Last active August 29, 2015 14:19
Show Gist options
  • Save headswe/d658aa3714a0392cebf5 to your computer and use it in GitHub Desktop.
Save headswe/d658aa3714a0392cebf5 to your computer and use it in GitHub Desktop.
Demand : Map
//Dictionary. Fast lookups are critical.
//Dictionaries provide fast lookups,based on keys,to get values. With them, we use keys and values of any type
// returns a new Dictionary handle
_map = createDictionary;
// dicthandle set [key,value];
_map set ["mypos",getpos player];
_map set [32,"threetwo"];
_map set ["friend",_otherPlayer];
// dicthandle get [key,defaultValue];
// returns value
_value = _map get [32,-1];
// dicthandle hasKey index
// returns boolean
_map hasKey 32;
// Keys dicthandle
// returns all keys in array
Keys _map
// Values dicthandle
// returns all Values in array
Values _map
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment