Currently it seems to working. Now I'm curious why there is ObjRawSet() istead of this["´"] := new _Struct()? I've never use that earlier so I'm not quite sure whats the reason.
PS. it working but only partialy, as I try to stroe some data in stepN then it's stored as class variable instead of in struct
Code: Select all
#Include <_Struct>
q := new myclass()
q.dim.2 := 666
;q.dStepN := 123456
msgbox,% q.dim.2 "`n" q[] "`n" q.stepN
;q.tst()
;al(q)
mem_display(q[],0,10,1,"int") ;<--- see field 3
return
class myclass extends _Struct
{
__new(){
ObjRawSet(this,"´",new _Struct("int dim[3],int stepN,int dStepN,float* m"))
this.dim.1 := 2
this.dim.2 := 4
this.dim.3 := 6
this.stepN := 777 ;<--- it is stored as class variable, not in structure
}
__Get(p*){
return this["´"][p*]
}
tst(){
msgbox,% "test"
}
}
mem_display(memPtr,start,cnt,inc,dataType="double",round=6,splitLine=0){
static ds := {uchar:1,char:1,uschort:2,short:2,uint:4,int:4,float:4,double:8,int64:8}
dataSize := ds[dataType]
str := ""
loop,% cnt
{
n := A_Index-1
offset := (start+n*inc)*dataSize
val := numGet(memPtr+0,offset,dataType)
if(splitLine>0 && mod(n,splitLine)==0){
str .= "==============`n"
}
str .= round(A_Index-1+start) "`t" round(val,round) "`n"
}
msgbox,% str
}