class array<Class T>Source
Part of Enforce script essentials
Methods 28
proto native int Count()O(1) complexity.
Returns: Number of elements of the array
proto native void Clear()Destroyes all elements of the array and sets the Count to 0. The underlying memory of the array is not freed.
proto void Set(int n, T value)Sets n-th element to given value.
proto int Find(T value)Tries to find the first occurance of given value in the array.
Returns: Index of the first occurance of `value` if found, -1 otherwise
proto T Get(int n)Returns: Element at the index `n`
proto int Insert(T value)Inserts element at the end of array.
value- Element to be inserted
Returns: Position at which element is inserted
Inserts element at certain position and moves all elements behind this position by one.
value- Element to be inserted
index- Position at which element is inserted. Must be less than Array::GetCardinality()
Returns: Number of elements after insertion
Show 24 more
, ContainerWithCargoAndAttachments.RecomputeContainers(), DayZCreatureAnimScriptDebug.OnAnimationEvent(), InventoryItem.ProcessImpactSoundEx(), MissionMainMenu.SortedInsert(), PlayerAgentPool.GetDebugObject(), PlayerContainer.Insert(), PlayerStatsPCO_Base.RegisterStat(), PluginConfigDebugProfile.AddWeatherPreset(), PluginDayZCreatureAIDebug.SendSyncMessages(), PluginDeveloperSync.SendRPCHealth(), PluginDeveloperSync.SendRPCLevels(), PluginDeveloperSync.SendRPCStats(), PluginDeveloperSync.SendRPCStomach(), PluginItemDiagnostic.GetLocalProperties(), PluginItemDiagnostic.SendRPC(), RadialQuickbarMenu.CheckForLightsAndNVG(), RecipeBase.InsertIngredientEx(), RemotePlayerDamageDebug.AddDamage(), ServerBrowserTabPc.SortedInsertAsc(), ServerBrowserTabPc.SortedInsertDesc(), ServerBrowserTabPc.SortedInsertEx(), SymptomManager.QueueUpPrimarySymptom(), WeaponManager.OnMagazineInventoryEnter(), and WeaponManager.SortMagazineAfterLoad()void InsertAll(notnull array<T> from)Inserts all elements from array
fromarray<T>array from which all elements will be added
TStringArray arr1 = new TStringArray;
arr1.Insert( "Dave" );
arr1.Insert( "Mark" );
arr1.Insert( "John" );
TStringArray arr2 = new TStringArray;
arr2.Insert( "Sarah" );
arr2.Insert( "Cate" );
arr1.InsertAll(arr2);
for ( int i = 0; i < arr1.Count(); i++ )
{
Print( arr1.Get(i) );
}
delete arr2;
delete arr1;
>> "Dave"
>> "Mark"
>> "John"
>> "Sarah"
>> "Cate"proto native void Remove(int index)Removes element from array. The empty position is replaced by last element, so removal is quite fast but do not retain order.
index- Index of element to be removed
proto native void RemoveOrdered(int index)Removes element from array, but retain all elements ordered. It's slower than Remove
index- Index of element to be removed
proto native void Resize(int newSize)Resizes the array to given size. If the `newSize` is lower than current Count overflowing objects are destroyed. If the `newSize` is higher than current Count missing elements are initialized to zero (null).
proto native void Reserve(int newSize)Resizes the array to given size internally. Is used for optimization purposes when the approx. size is known beforehand
proto native void Swap(notnull array<T> other)Swaps the contents of this and `other` arrays. Does not involve copying of the elements.
proto native void Sort(bool reverse = false)Sorts elements of array, depends on underlaying type.
Copes contents of `from` array to this array.
Returns: How many elements were copied
Show 10 more
, ColorValuesData.ColorValuesData(), ColorValuesData.SetValues(), EntityAI.SetInvisibleRecursive(), GameplayEffectsDataImage.GameplayEffectsDataImage(), MiscGameplayFunctions.FilterObstructedObjectsByGrouping(), MiscGameplayFunctions.TransferEntityHealth(), PlayerRestrictedAreaInstance.GetRandomSafePos3D(), PPEMatClassParameterColor.Update(), PPERequesterBase.SetTargetValueColor(), and WeaponManager.SortMagazineAfterLoad()proto int Init(T init[])void RemoveItem(T value)Show 34 more
, ArrowManagerBase.RemoveArrow(), BoatScript.RemoveAction(), BuildingBase.RemoveAction(), CachedEquipmentStorageBase.Remove(), CargoContainer.ReleaseLock(), CargoContainer.RemovedFromCargo(), CarScript.RemoveAction(), ClientData.RemovePlayerBase(), Container.Remove(), EntityAI.EEItemDetached(), GameplayEffectsDataBleeding.CleanupBleedingIndicators(), HandsContainer.AttachmentRemoved(), HandsContainer.DestroyAtt(), HandsContainer.DestroyCargo(), HandsContainer.OnPerformCombination(), InputUtils.InitInputMetadata(), ItemBase.RemoveAction(), MapNavigationBehaviour.OnItemNotInPlayerPossession(), MissionGameplay.RemoveActiveInputExcludes(), MissionGameplay.RemoveActiveInputRestriction(), MissionServer.RemoveActiveInputExcludes(), MissionServer.RemoveActiveInputRestriction(), NotificationSystem.LoadNotificationData(), NotificationSystem.Update(), OutdoorThermometerManager.Remove(), PlayerBase.RemoveActiveNV(), PlayerLightManager.UpdateLightSourceList(), PluginConfigDebugProfile.RemovePreset(), PluginInventoryRepair.Remove(), PluginManager.UnregisterPlugin(), PluginSceneManager.DeleteSelectedObject(), ServerBrowserMenuNew.AddFavorite(), TFModule.Run(), and WeaponManager.OnMagazineInventoryExit()void RemoveItemUnOrdered(T value)Show 14 more
, LeftArea.GetCurrentContainerBottomY(), LeftArea.GetCurrentContainerTopY(), LightDimming.SwapConfig(), PluginConfigDebugProfile.GetItemParams(), PMTPlayback.CheckOnePlayingSA(), PMTPlayback.CheckOnePlayingSAAD(), PMTPlayback.CheckStop(), ScriptConsoleEnfScriptServerTab.OnSelected(), ScriptConsoleEnfScriptTab.OnSelected(), ScriptConsoleItemsTab.SelectPreset(), ScriptConsoleVicinityTab.OnClick(), ScriptConsoleVicinityTab.UpdateSelected(), SlotsContainer.GetSlotIcon(), and UndergroundTriggerCarrier.SpawnTrigger()void Debug()Print all elements in array
Returns: void
my_array.Debug();
>> "One"
>> "Two"
>> "Three"int GetRandomIndex()Returns a random index of array. If Count is 0, return index is -1 .
Returns: int Random index of array
Print( my_array.GetRandomIndex() );
>> 2T GetRandomElement()Returns a random element of array
Returns: int Random element of array
Print( my_array.GetRandomElement() );
>> "Three"Show 11 more
, DayZGame.CreateRandomPlayer(), DayZIntroSceneXbox.CreateRandomCharacter(), IntroSceneCharacter.CreateNewCharacterRandom(), MenuDefaultCharacterData.GenerateRandomEquip(), MissionServer.EquipCharacter(), OnlineServices.GetRandomFreeResult(), PlayerSpawnHandler.GetRandomCharacterPreset(), PlayerSpawnHandler.SelectAndSpawnCargoSet(), PlayerSpawnHandler.SelectAndSpawnSlotEquipment(), PlayerSpawnPreset.GetRandomCharacterType(), and ServerBrowserTab.InitDummyServers()void InsertArray(array<T> other)void Invert()Returns a index in array moved by specific number
Returns: int Moved index in this array
Print( "Count: "+ my_array.Count() );
Print( "Moved 1:"+ my_array.MoveIndex(2, 1) );
Print( "Moved 3:"+ my_array.MoveIndex(2, 2) );
>> "Count: 4"
>> "Moved index 2 by 1: 3";
>> "Moved index 2 by 2: 0";void ShuffleArray()Returns an index where 2 arrays start to differ from each other
Returns: int Index from where arrays differ
array<int> arr1 = {0,1,2,3};
array<int> arr2 = {0,1,3,2};
int differsAt = arr1.DifferentAtPosition(arr2);
Print(differsAt);
>> 2