DIFF

class map<Class TKey,Class TValue>Source

Part of Enforce script essentials

Associative array template
usage:

autoptr map<string, int> prg_count = new map<string, int>;

// fill
project_locations.Insert("dayz", 10);
project_locations.Insert("arma", 20);
project_locations.Insert("tkom", 1);

Print(project_locations.Get("arma")); // prints '20'

Methods 22

proto native int Count()

Returns: The number of elements in the hashmap.

proto native void Clear()

Clears the hash map.

proto TValue Get(TKey key)

Search for an element with the given key.

key
The key of the element to find

Returns: Pointer to element data if found, NULL otherwise.

proto bool Find(TKey key, out TValue val)

Search for an element with the given key.

key
The key of the element to find
val
result is stored to val

Returns: returns True if given key exist.

Referenced by AmmoEffects.GetAmmoEffectTypename(), AmmoEffects.GetAmmoParticleID(), AmmoTypesAPI.AddExplosionParticleEffect()
Show 43 more, BaseBuildingBase.DestroyAreaDamage(), CachedEquipmentStorage.ProcessAttachments(), CachedEquipmentStorage.ProcessCargo(), CrashSoundSets.GetSoundSetByHash(), DamageSystem.GetDamageDisplayName(), DayZPlayerCameras.GetTransitionTime(), EasterEgg.PlaySFX(), EmoteManager.CanPlayEmote(), EmoteManager.OnCallbackEnd(), EmoteManager.OnSyncJuncture(), EmoteManager.PlayEmote(), EntityAI.GetSkinningBloodInfectionChance(), ErrorHandlerModuleScript.GetProperties(), ErrorHandlerModuleScript.OnErrorThrown(), ExplosivesBase.AddExplosionEffectForSurface(), ExplosivesBase.GetParticleExplosionID(), FoodStage.CanTransitionToFoodStageType(), FoodStage.GetAllCookingPropertiesForStage(), FoodStage.GetCookingPropertyFromIndex(), FoodStage.GetNextFoodStageType(), FoodStage.GetNutritionPropertyFromIndex(), FoodStage.UpdateVisualsEx(), HiddenSelectionsData.GetHiddenSelectionIndex(), MainMenuData.GetDLCModInfoByName(), MissionServer.EquipCharacter(), ParticleList.GetParticleIDByName(), ParticleList.GetParticlePath(), ParticleList.RegisterParticle(), PlayerBase.GetBloodyHandsPenaltyChancePerAgent(), PlayerListScriptedWidget.Reload(), PlayerListScriptedWidget.ReloadLocal(), PMTF.GetManager(), PPEClassBase.InsertParamValueData(), SEffectManager.EffectUnregister(), SEffectManager.GetCachedSoundParam(), ServerBrowserHelperFunctions.AddMapInfo(), ServerBrowserTab.Unfavorite(), StaminaConsumers.HasEnoughStaminaFor(), StaminaConsumers.HasEnoughStaminaToStart(), StaminaHandler.SetCooldown(), TriggerEffectManager.IsPlayerInTriggerType(), TriggerEffectManager.OnPlayerEnter(), and TriggerEffectManager.OnPlayerExit()
proto TValue GetElement(int index)

Return the i:th element in the map. Note: This operation is O(n) complexity. Use with care!

index
The position of the element in the map

Returns: The element on the i:th position

proto TKey GetKey(int i)

Return the i:th element key in the map. Note: This operation is O(n) complexity. Use with care!

i
The position of the element key in the map

Returns: Return key of i-th element

proto void Set(TKey key, TValue value)

Sets value of element with given key. If element with key not exists, it is created. Note: creating new elements is faster using Insert function.

proto void Remove(TKey key)

Removes element with given key.

proto void RemoveElement(int i)

Removes i:th element with given key. Note: This operation is O(n) complexity. Use with care!

i
The position of the element key in the map
proto bool Contains(TKey key)

Returns if map contains element with given key.

proto bool Insert(TKey key, TValue value)

Insert new element into hash map.

key
Key of element to be inserted.
value
Data of element to be inserted.
proto int Copy(map<TKey,TValue> from)
bool ReplaceKey(TKey old_key, TKey new_key)
References Contains(), Get(), Remove()
Show 1 more, Set()
bool GetKeyByValueChecked(TValue value, out TKey key)
References Count(), GetElement(), and GetKey()
proto native MapIterator Begin()
proto native MapIterator End()
proto TKey GetIteratorKey(MapIterator it)
proto TValue GetIteratorElement(MapIterator it)