AutoHotkey Community

It is currently May 26th, 2012, 10:12 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 83 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next
Author Message
 Post subject:
PostPosted: October 22nd, 2008, 5:18 pm 
Offline

Joined: November 24th, 2007, 9:07 pm
Posts: 774
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 22nd, 2008, 7:04 pm 
Offline

Joined: December 13th, 2006, 7:16 am
Posts: 48
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 &


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 22nd, 2008, 9:18 pm 
Offline

Joined: November 24th, 2007, 9:07 pm
Posts: 774
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 :)

_________________
Ben

My Trac projects
My Wiki
[Broken] - My music


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 23rd, 2008, 5:31 am 
Offline

Joined: March 27th, 2008, 2:14 pm
Posts: 700
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 23rd, 2008, 6:27 am 
Offline

Joined: December 13th, 2006, 7:16 am
Posts: 48
Oh man! If I knew about that beforehand, AHKA would be a lot different. Oh well XD


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 23rd, 2008, 4:18 pm 
Offline

Joined: November 24th, 2007, 9:07 pm
Posts: 774
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 :)

_________________
Ben

My Trac projects
My Wiki
[Broken] - My music


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 27th, 2008, 12:08 am 
Offline

Joined: November 24th, 2007, 9:07 pm
Posts: 774
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 27th, 2008, 1:37 am 
Offline

Joined: March 27th, 2008, 2:14 pm
Posts: 700
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 :P ) or maybe tomorrow.

:)

_________________
Scripts - License


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 27th, 2008, 3:41 am 
Offline

Joined: November 24th, 2007, 9:07 pm
Posts: 774
I can hardly wait :)

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 28th, 2008, 3:43 am 
Offline

Joined: November 24th, 2007, 9:07 pm
Posts: 774
Please say you're going to release tonight :)

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 28th, 2008, 3:53 am 
Offline

Joined: March 27th, 2008, 2:14 pm
Posts: 700
I'm tryin, patience, patience. :D Actually, I'd be faster if I didn't have to keep replying to requests for it to be done. ;) :P ;)

_________________
Scripts - License


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 28th, 2008, 4:08 am 
Offline

Joined: November 24th, 2007, 9:07 pm
Posts: 774
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 28th, 2008, 4:30 am 
Offline

Joined: March 27th, 2008, 2:14 pm
Posts: 700
:D I don't mind at all, I'm just giving you trouble. :P I'm glad my posts have helped you. :)


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

:)

_________________
Scripts - License


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 28th, 2008, 6:05 am 
Offline

Joined: November 24th, 2007, 9:07 pm
Posts: 774
Woohoo, A custom bmcclure release :)

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 28th, 2008, 8:00 am 
Offline
User avatar

Joined: January 25th, 2006, 8:08 am
Posts: 225
Location: Froschtümpel
Unless explicitly forbidden in your preface for version Beta3: ;)
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 ... :(


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 83 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: xXDarknessXx and 8 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group