Jump to content

Update wiki example for 2d arrays - suggestion


Myicq
 Share

Recommended Posts

I had a need today to make 2d arrays. Could not remember how, so on to the Wiki.

It's all nicely explained, BUT unfortunately I was in doubt which parameter is rows, which is columns.

The Wiki shows example of [3][3], which does not explain much. Nothing is mentioned about the order.

May I suggest to update Wiki to show example for something like [3][5] and clearly indicate which of 3 is rows, which is columns ?

Just a suggestion, really :)

Thanks

I am just a hobby programmer, and nothing great to publish right now.

Link to comment
Share on other sites

The standard convention is rows then columns, but it doesn't really matter.  As long as your script is consistant in the way it uses the array, you can order them either way.

Link to comment
Share on other sites

All users have access to edit the wiki. So there was no need to request.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

*Scratches head*. ... http://www.mediawiki.org/wiki/Help:Tables

Oops. Brain lock on wrong language.

Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Link to comment
Share on other sites

I think the concept of arrays is perfectly described in the help file.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

What about the last line in the link above: "The use of an Array inside another Array can affect the execution speed of your script." Is this correct? I don't think so.

Link to comment
Share on other sites

Why do you think it doesn't?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

In the three examples below there are three arrays with an integer, a string, and an array (an array inside another array). In the loops a variable is assigned the content of the integer, string and array.

Example1 is the fastest and Example3 is the slowest. But the time increase from Example2 (string) to Example3 (array) is not much bigger than the time increase from Example1 (integer) to Example2 (string).

Conclusion: The time increase for using an array inside an array is not significant, compared to using other data types (strings, floats) inside an array.

 

Example1()
Example2()
Example3()

Func Example1()
  Local $v, $i = 3, $a1[4] = [ 1, 2, $i, 4 ]
  Local $hTimer = TimerInit()
  For $i = 1 To 100000
    $v = $a1[2] ; $v = $i
  Next
  ConsoleWrite( "Time (integer) = " & TimerDiff( $hTimer ) & @CRLF )
EndFunc

Func Example2()
  Local $v, $s = "This is a string", $a1[4] = [ 1, 2, $s, 4 ]
  Local $hTimer = TimerInit()
  For $i = 1 To 100000
    $v = $a1[2] ; $v = $s
  Next
  ConsoleWrite( "Time (string) = " & TimerDiff( $hTimer ) & @CRLF )
EndFunc

Func Example3()
  Local $v, $a2[4] = [ 1, 2, 3, 4 ], $a1[4] = [ 1, 2, $a2, 4 ]
  Local $hTimer = TimerInit()
  For $i = 1 To 100000
    $v = $a1[2] ; $v = $a2
  Next
  ConsoleWrite( "Time (array) = " & TimerDiff( $hTimer ) & @CRLF )
EndFunc
Link to comment
Share on other sites

  • Moderators

Ditto on 8.1 x64. Difference is not huge for this example, but enough that I think the statement is valid.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

I just think it's a pity that a lot of AutoIt users avoid to use this nice feature (arrays inside an array) because of this warning. They think the loops to handle the arrays will be running for 20 seconds more. The fact is that they probably only will be running for 20 milli seconds more.

I've used this feature a lot (since version 3.6). I've never experienced performance issues. When I have performance issues with arrays, it's nearly always caused by the ReDim statement.

Link to comment
Share on other sites

  • Moderators

LarsJ,

I will amend the Help file text to reflect the current situation reflected by the results posted above - which match my own tests. :)

M23

Edit: "An array stored inside another array can be accessed directly, but this method is slightly slower than accessing other datatypes:"

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...