AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[lib] SimpleArray - short & fast string array - v3.5
Goto page Previous  1, 2, 3, 4, 5  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
bmcclure



Joined: 24 Nov 2007
Posts: 766

PostPosted: Wed Oct 22, 2008 5:18 pm    Post subject: Reply with quote

With ByRef you're only passing a reference to a variable.

You aren't actually passing the data contents of the variable, but rather just a pointer to it.

Since the variable doesn't get copied somewhere else in memory, it is much faster for large variables (arrays).

You can't pass direct data to it, such as your first example, because it won't be getting a reference to a variable.

When you specify the variable in the function, however, you are creating the variable, and then passing its reference to the function, meaning it will still work with a ByRef.
_________________
Ben

My Trac projects
My Wiki
[Broken] - My music
Back to top
View user's profile Send private message
olegbl



Joined: 13 Dec 2006
Posts: 48

PostPosted: Wed Oct 22, 2008 7:04 pm    Post subject: Reply with quote

Hm, I've always wondered, is there an equivalent of the C & in AHK? It would make life so much easier for people...
Edit: p.s. not the byref &, the pointer &
Back to top
View user's profile Send private message
bmcclure



Joined: 24 Nov 2007
Posts: 766

PostPosted: Wed Oct 22, 2008 9:18 pm    Post subject: Reply with quote

I know we're not quite there yet, but do you have any indication how accessing an array with named indexes will work?

Is it possible to access, add to, and delete from nested arrays using named indexes?

For example, say I have an array with a 'steamwin' key, under which I have an array with a numbered index for each SteamWin, under which I have an array of named keys such as 'guinum', 'var', 'label', etc.

Is it possible, using some sort of path or other mechanism, to add and remove directly in the steamwin => 1 sub-array? Not sure how much sense this makes to you, or how feasible it is while keeping the array simple. Let me know if I need to explain this better Smile
_________________
Ben

My Trac projects
My Wiki
[Broken] - My music
Back to top
View user's profile Send private message
infogulch



Joined: 27 Mar 2008
Posts: 378

PostPosted: Thu Oct 23, 2008 5:31 am    Post subject: Reply with quote

Accessing nested arrays with names/indexes will be supported.

Here is the line from get:
Code:
SA_Get( Array, nIdx1=1, nIdx2="", nIdx3="", nIdx4="", nIdx5="" )
; nIdx in the params means a name or index. (you can have as many as 254 nIdx* params as long as they are numbered sequentially)

note that this function will be overloaded with SA_Get_(byref array, idx) which only accepts a number for idx. Use this if you need speed specifically and aren't referencing named indexes, as it uses byref and is shorter.

As for C's & operator ... Try using &. Lol: Address

For an example of true binary arrays, and it's example usage of the & operator, look at DerRaphael's [stdlib] A_Array - True Binary Arrays RC2 (w/ testsuite)
Now, THAT can take anything. But it's really, really, really hard to do in ahk. I attempted and abandoned the project myself, actually.
_________________

Scripts
- License
Back to top
View user's profile Send private message
olegbl



Joined: 13 Dec 2006
Posts: 48

PostPosted: Thu Oct 23, 2008 6:27 am    Post subject: Reply with quote

Oh man! If I knew about that beforehand, AHKA would be a lot different. Oh well XD
Back to top
View user's profile Send private message
bmcclure



Joined: 24 Nov 2007
Posts: 766

PostPosted: Thu Oct 23, 2008 4:18 pm    Post subject: Reply with quote

Awesome,

So I could access a 2-level deep array with names by doing something like
Code:
Var := SA_Get(SteamWin, 1, 'guinum')
and this would retrieve the value of the 'guinum' index under the first index in the SteamWin array?

If so, sounds great to me! I can hardly wait! Right now I use flat variables to save all values for each SteamWin window that's opened; if I can keep them all in a deep array with named indexes, it'll save me from having thousands of other variables Smile
_________________
Ben

My Trac projects
My Wiki
[Broken] - My music
Back to top
View user's profile Send private message
bmcclure



Joined: 24 Nov 2007
Posts: 766

PostPosted: Mon Oct 27, 2008 12:08 am    Post subject: Reply with quote

How will one be able to loop through an array with named indexes? Also, how would I retrieve the name of the index inside the loop?

I'd like to have a dynamically generated array, and be able to later determine what index a particular value belongs to.
_________________
Ben

My Trac projects
My Wiki
[Broken] - My music
Back to top
View user's profile Send private message
infogulch



Joined: 27 Mar 2008
Posts: 378

PostPosted: Mon Oct 27, 2008 1:37 am    Post subject: Reply with quote

bmcclure wrote:
I'd like to ... be able to ... determine what index a particular value belongs to
Yes, this will be possible with SA_NameIdx(Array, Idx)

bmcclure wrote:
So I could access a 2-level deep array with names by doing something like ... {code}
Yes. (you'd have to use double quotes tho)

Almost done. I'll release tonight (for me Razz ) or maybe tomorrow.

Smile
_________________

Scripts
- License
Back to top
View user's profile Send private message
bmcclure



Joined: 24 Nov 2007
Posts: 766

PostPosted: Mon Oct 27, 2008 3:41 am    Post subject: Reply with quote

I can hardly wait Smile

Thanks a lot for implementing named indexes and the other great changes coming in the rewrite! This is quickly becoming by favorite array library!
_________________
Ben

My Trac projects
My Wiki
[Broken] - My music
Back to top
View user's profile Send private message
bmcclure



Joined: 24 Nov 2007
Posts: 766

PostPosted: Tue Oct 28, 2008 3:43 am    Post subject: Reply with quote

Please say you're going to release tonight Smile

Fallout 3 comes out tomorrow and I won't be putting nearly as much time into SteamLab for at least several days. But I've got most of my new array functions in place, so it'll be pretty painless once you actually release the new version I think.
_________________
Ben

My Trac projects
My Wiki
[Broken] - My music
Back to top
View user's profile Send private message
infogulch



Joined: 27 Mar 2008
Posts: 378

PostPosted: Tue Oct 28, 2008 3:53 am    Post subject: Reply with quote

I'm tryin, patience, patience. Very Happy Actually, I'd be faster if I didn't have to keep replying to requests for it to be done. Wink Razz Wink
_________________

Scripts
- License
Back to top
View user's profile Send private message
bmcclure



Joined: 24 Nov 2007
Posts: 766

PostPosted: Tue Oct 28, 2008 4:08 am    Post subject: Reply with quote

Heh, alright, I'll take that as a hint to keep quiet. Thankfully, your replies have already saved me hours of coding time later in preparing.
_________________
Ben

My Trac projects
My Wiki
[Broken] - My music
Back to top
View user's profile Send private message
infogulch



Joined: 27 Mar 2008
Posts: 378

PostPosted: Tue Oct 28, 2008 4:30 am    Post subject: Reply with quote

Very Happy I don't mind at all, I'm just giving you trouble. Razz I'm glad my posts have helped you. Smile


Oh, yeah. Btw, I just released beta3. Check the first post if you really want to see. Wink

Smile
_________________

Scripts
- License
Back to top
View user's profile Send private message
bmcclure



Joined: 24 Nov 2007
Posts: 766

PostPosted: Tue Oct 28, 2008 6:05 am    Post subject: Reply with quote

Woohoo, A custom bmcclure release Smile

It seems some of the characters you've used aren't displayed properly for me from my browser; I'm assuming they're outside the normal char range? Can those be safely copied and pasted to a text editor without being changed at all? Chrome and EmEditor both show different symbols for the characters, so I'm worried I may be damaging the script by doing it that way.

If it is an issue, is it possible to provide an actual AHK file for download to make sure nothing gets changed? I could provide web space for it if needed.
_________________
Ben

My Trac projects
My Wiki
[Broken] - My music
Back to top
View user's profile Send private message
hoppfrosch



Joined: 25 Jan 2006
Posts: 39
Location: Froschtümpel

PostPosted: Tue Oct 28, 2008 8:00 am    Post subject: Reply with quote

Unless explicitly forbidden in your preface for version Beta3: Wink
I tried to use this version/example and just within the SA_Del() the function "TT(...)" is called.

Where does the function
Code:
TT(fmIdx "`t" fmnIdx "`n" toIdx "`t" tonIdx)

origin from?

Cannot find it ... Sad
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3, 4, 5  Next
Page 3 of 5

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group