Chime in!
page 1: using %% operator to deref "obj1.objN.key" stringified objects
page ~5: super-optimized json in-out function.
page 8: pretty-printing of stringified Float numbers. alternative to Format
page ~10: improving mcode
page 13: fastest StrLen for not AHK-returned strings
//////////////////////////////
Deref issue
1)
Code: Select all
class a1{
static Key1:="some string"
static Key2:="another string"
}
for i,k in ["a1.Key1", "a1.Key2"]{ ;array with prototype class members
%k%:="new value"
}
but the above code gives an AHK error: "the following var name contains an illegal character". deref doesn't work with .names
2)
Code: Select all
for i,k in [a1.Key1, a1.Key2]{ ;array with prototype class members
k:="new value"
}
msgbox(a1.Key1 "|" a1.Key2)
3)
Code: Select all
class a1{
static Key1:="some string"
static Key2:="another string"
}
for i,k in ["a1.Key1", "a1.Key2"]{ ;array with prototype class members
m:=StrSplit(k,"."), %m[1]%[m[2]]:="new value"
}
msgbox(a1.Key1 "|" a1.Key2)
Is there a simpler way to achieve the purpose?
btw, a line from the code above:
Code: Select all
m:=StrSplit(k,"."), u:=%m[1]%[m[2]], u:="new value"
So I have to use:
Code: Select all
m:=StrSplit(k,"."), u:=%m[1]%,p:=m[2], u[p]:="new value"