Guest Posted December 11, 2015 Share Posted December 11, 2015 (edited) I think it is good idea to make this possible: Such a an array allows you to hold information in a more convenient and efficient way.Example:This is a simple example. It does not have to be only TRUE / FALSE . it can be more of course. Edited December 12, 2015 by Guest Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 11, 2015 Moderators Share Posted December 11, 2015 gil900,And why do you see this as a good idea? Can you share a situation where it would be useful to have negative array indices?M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Guest Posted December 11, 2015 Share Posted December 11, 2015 gil900,And why do you see this as a good idea? Can you share a situation where it would be useful to have negative array indices?M23It is difficult for me at the moment to describe the situation in general and also explain arguments why it is good.I will try to explain later Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 11, 2015 Moderators Share Posted December 11, 2015 gil900,I will try and contain my impatience.....M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
guinness Posted December 11, 2015 Share Posted December 11, 2015 Build it yourself and don't rely on others to do it for you. The fact you can't come up with a use case, means this is just a feature for you only. 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 parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Guest Posted December 11, 2015 Share Posted December 11, 2015 Suppose you have a main array.And in that main array you need to store this kind of array: In this array the the only information that can continue without end is Item X Other information needs to be stored in array is regular information - information that needs only one slot such as: how many Items the array contains, variable that represents a specific setting for all Items and more. The problem is - you have one slot for it. In this it is the 0x0 slot. If I want to write in it more then one value directly (I want directly. don't want to create in it new array)Then this is not possible. Why I don't want to create new array in it?If your code need to use some variable Intensively then you may want to save the process of loading /reading other array Every 10/5 ms just to read one value. I will continue later Link to comment Share on other sites More sharing options...
iamtheky Posted December 11, 2015 Share Posted December 11, 2015 Can you describe that in code? The wording is tough to decipher. JohnOne 1 ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
Guest Posted December 11, 2015 Share Posted December 11, 2015 Can you describe that in code? The wording is tough to decipher.Which is why I did not try to start explaining before.. sorry.It is much more the idea of organizing data more efficiently Be patient. I'm working on a image that will show when it can be very useful (efficient data organization).. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 11, 2015 Moderators Share Posted December 11, 2015 iamtheky,As I understand it, the OP wants to have arrays that start at the [1] index with an unlimited number of prior indices ([0], [-1], [-2], etc) which can hold metadata such as the "count in [0]" so common in AutoIt arrays.My response would be:Have as many such elements as you need and then start the array "proper" at the index which holds the first "data" rather then "metadata" - For...To...Next does not care which values you pass as limits and calculating "index - x" will not cost much.Use an array in the [0] element to hold all the metadata. You suggest that it would seriously slow the script - I would argue the contrary. Look at my GUIListViewEx UDF - there are many occasions where I set Local variables to the content of elements of an "array in array" so that there is not the repeated reading of these embedded values.But let us wait to see what this promised image brings - perhaps I am completely wrong, and not for the first time!M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Guest Posted December 11, 2015 Share Posted December 11, 2015 (edited) I made this picture:Hope this helps you understand the concept.This opens up the possibility of creating a more complicated information and store it more efficiently. This example i have in my head of such data organization Edited December 11, 2015 by Guest Link to comment Share on other sites More sharing options...
iamtheky Posted December 11, 2015 Share Posted December 11, 2015 just use a map, then you can call the indices whatever you want? JohnOne 1 ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
JohnOne Posted December 11, 2015 Share Posted December 11, 2015 This opens up the possibility of creating a more complicated information and store it more efficiently. This example i have in my head of such data organizationThis opens up the possibility of creating more complicated information and storing it more efficiently. This is an example I have in my head of such data organization. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
JohnOne Posted December 11, 2015 Share Posted December 11, 2015 (edited) just use a map, then you can call the indices whatever you want?Good point, but with one minor problem. They're not in stable release Edited December 11, 2015 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
iamtheky Posted December 11, 2015 Share Posted December 11, 2015 then fake it ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
Guest Posted December 11, 2015 Share Posted December 11, 2015 just use a map, then you can call the indices whatever you want?Can I store Map variable inside array? Link to comment Share on other sites More sharing options...
JohnOne Posted December 11, 2015 Share Posted December 11, 2015 (edited) The point would be to use a map instead of an array, you can store a map in a map.Not sure about map in array. Edited December 11, 2015 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
iamtheky Posted December 11, 2015 Share Posted December 11, 2015 definitely read the thread, if you start getting fancy and throwing dictionaries in the dictionary then the way I am retrieving data would have to be adjusted. I would be happy to play along if you run into issues. ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
Guest Posted December 12, 2015 Share Posted December 12, 2015 (edited) iamtheky,As I understand it, the OP wants to have arrays that start at the [1] index with an unlimited number of prior indices ([0], [-1], [-2], etc) which can hold metadata such as the "count in [0]" so common in AutoIt arrays.My response would be:Have as many such elements as you need and then start the array "proper" at the index which holds the first "data" rather then "metadata" - For...To...Next does not care which values you pass as limits and calculating "index - x" will not cost much.Use an array in the [0] element to hold all the metadata. You suggest that it would seriously slow the script - I would argue the contrary. Look at my GUIListViewEx UDF - there are many occasions where I set Local variables to the content of elements of an "array in array" so that there is not the repeated reading of these embedded values.But let us wait to see what this promised image brings - perhaps I am completely wrong, and not for the first time!M23 Have as many such elements as you need and then start the array "proper" at the index which holds the first "data" rather then "metadata" - For...To...Next does not care which values you pass as limits and calculating "index - x" will not cost much.I hate to code this way.. it is mess. and I never did itI don't want loop that start check from number that is > 1 just because I need to use the first indexes for the metadata (thanks for this word).I see it wrong to write code like this even if it seems that it is the best option for the machine. Use an array in the [0] element to hold all the metadata. You suggest that it would seriously slow the script - I would argue the contrary. Look at my GUIListViewEx UDF - there are many occasions where I set Local variables to the content of elements of an "array in array" so that there is not the repeated reading of these embedded values.I didn't looked at it but I know what you did. you just reducing the number of times of reading information from array in array..But If you have array like I suggested then the "array in array" requirement is reduced significantly and this is better. not only for performance but also (perhaps especially) for much cleaner code. By the way,I was wrong about the last picture I sent.I should organize the data in this way: This is how it may look with real data (Non-variable names)This is simple example. It does not have to be only TRUE / FALSE . it can be more then that of course.I added this image to the first post Edited December 12, 2015 by Guest Link to comment Share on other sites More sharing options...
czardas Posted December 12, 2015 Share Posted December 12, 2015 (edited) Having negative array indices offers no advantage that I can see. What the images above are meant to demonstrate is also unclear. Looking at the code in the example I see... While Sleep(10). I don't like this loop syntax: . It is not a good idea to rely on the return value of a function which is documented as not having one. Using such a return value may seem clever, but it makes the code more difficult to understand. Edited December 12, 2015 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
Guest Posted December 12, 2015 Share Posted December 12, 2015 (edited) Having negative array indices offers no advantage that I can see. What the images above are meant to demonstrate is also unclear. Looking at the code in the example I see... While Sleep(10). I don't like this loop syntax: . It is not a good idea to rely on the return value of a function which is documented as not having one. Using such a return value may seem clever, but it makes the code more difficult to understand.Having negative array indices offers no advantage that I can see. The ability to store more info such as count ("metadata") without the need to create more space in dimension 2 (Which it is expensive as long the array grows) or use indexes greater than 1 (Which is very uncomfortable to code loop that checking from index 4 for example)You have almost unlimited space for "metadata" (such as count and more) and this space is cheaper ( In terms of performance & memory and convenience)In terms of convenience:You can have as many "metadata" in the array while still using For $i = 1 to $Array[0] because most/all of it exists behind the the 0.In terms of performance and memory:You don't have to create new Array inside the Array just to store the "metadata". You saving the need of Extracting new array every time the code needs to reed some value.In less words: This data is more accessible for the code. important thing when you want to get the maximum from Autoit. Edited December 12, 2015 by Guest Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now