Array of Arrays in documents is outdated
code in http lexikos.github.io /v2/docs/Objects.htm#Usage_Arrays_of_Arrays Broken Link for safety
was totally unusable now.
The Ahkv2 support someting like Array[j, k] these days, however the __Item would not work properly since it's always interpret something like grid[3,5] as multi-dimensional arrays. As a result the property get and set defined in class will never be called by the script(see it below).
class Array2D {
a:=[]
__new(x, y) {
this.Length := x * y
this.Width := x
this.Height := y
this.a:=[]
}
__Item[x, y] {
get{
MsgBox "get"
return this.a[this.Width * (y-1) + x]
}
set{
MsgBox "set"
this.a[this.Width * (y-1) + x] := value
return value
}
}
}
grid :=new Array2D(1, 1)
grid[1, 4,1] := "#"
grid[2, 3,1] := "#"
grid[2, 2,1] := "#"
grid[3, 1,3] := "#"
gridtext := ""
Loop 3 {
x := A_Index
Loop 4 {
y := A_Index
gridtext .= grid[x, y,1] || "-"
}
gridtext .= "`n"
}
MsgBox gridtext
__Item not working and outdated documents
-
- Posts: 3
- Joined: 07 Mar 2017, 05:31
Re: __Item not working and outdated documents
the latest hv2 is based on a100
u can download a100's docs here from this link https://www.autohotkey.com/download/2.0/AutoHotkey_2.0-a100-52515e2.zip
u can download a100's docs here from this link https://www.autohotkey.com/download/2.0/AutoHotkey_2.0-a100-52515e2.zip
Who is online
Users browsing this forum: No registered users and 4 guests