| View previous topic :: View next topic |
| Author |
Message |
bmcclure
Joined: 24 Nov 2007 Posts: 766
|
Posted: Wed Oct 22, 2008 5:18 pm Post subject: |
|
|
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 |
|
 |
olegbl
Joined: 13 Dec 2006 Posts: 48
|
Posted: Wed Oct 22, 2008 7:04 pm Post subject: |
|
|
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 |
|
 |
bmcclure
Joined: 24 Nov 2007 Posts: 766
|
Posted: Wed Oct 22, 2008 9:18 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
infogulch
Joined: 27 Mar 2008 Posts: 378
|
Posted: Thu Oct 23, 2008 5:31 am Post subject: |
|
|
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 |
|
 |
olegbl
Joined: 13 Dec 2006 Posts: 48
|
Posted: Thu Oct 23, 2008 6:27 am Post subject: |
|
|
| Oh man! If I knew about that beforehand, AHKA would be a lot different. Oh well XD |
|
| Back to top |
|
 |
bmcclure
Joined: 24 Nov 2007 Posts: 766
|
Posted: Thu Oct 23, 2008 4:18 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
bmcclure
Joined: 24 Nov 2007 Posts: 766
|
Posted: Mon Oct 27, 2008 12:08 am Post subject: |
|
|
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 |
|
 |
infogulch
Joined: 27 Mar 2008 Posts: 378
|
Posted: Mon Oct 27, 2008 1:37 am Post subject: |
|
|
| 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 ) or maybe tomorrow.
 _________________
Scripts - License |
|
| Back to top |
|
 |
bmcclure
Joined: 24 Nov 2007 Posts: 766
|
Posted: Mon Oct 27, 2008 3:41 am Post subject: |
|
|
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 |
|
| Back to top |
|
 |
bmcclure
Joined: 24 Nov 2007 Posts: 766
|
Posted: Tue Oct 28, 2008 3:43 am Post subject: |
|
|
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 |
|
| Back to top |
|
 |
infogulch
Joined: 27 Mar 2008 Posts: 378
|
Posted: Tue Oct 28, 2008 3:53 am Post subject: |
|
|
I'm tryin, patience, patience. Actually, I'd be faster if I didn't have to keep replying to requests for it to be done.  _________________
Scripts - License |
|
| Back to top |
|
 |
bmcclure
Joined: 24 Nov 2007 Posts: 766
|
Posted: Tue Oct 28, 2008 4:08 am Post subject: |
|
|
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 |
|
 |
infogulch
Joined: 27 Mar 2008 Posts: 378
|
Posted: Tue Oct 28, 2008 4:30 am Post subject: |
|
|
I don't mind at all, I'm just giving you trouble. 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 |
|
| Back to top |
|
 |
bmcclure
Joined: 24 Nov 2007 Posts: 766
|
Posted: Tue Oct 28, 2008 6:05 am Post subject: |
|
|
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 |
|
| Back to top |
|
 |
hoppfrosch
Joined: 25 Jan 2006 Posts: 39 Location: Froschtümpel
|
Posted: Tue Oct 28, 2008 8:00 am Post subject: |
|
|
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 ...  |
|
| Back to top |
|
 |
|