Re: Define Record Variables, Like Pascal

"valery_vi" <[email protected]>
Newsgroups gmane.comp.windows.autoit.user
Message-ID <[email protected]>
piccaso wrote about useful case of beta AutoIt3.2.3.0:
http://www.autoitscript.com/forum/index.php?showtopic=42592
"..
Func CreatePerson()
    Local Struct $vPerson
        char Name[256]
        Int age
    EndStruct
    Return $vPerson
EndFunc

$vPiccaso = CreatePerson()
$vPiccaso.Name = "Flo"
$vPiccaso.age = 25

$vSomeOneElse = CreatePerson()
$vSomeOneElse.Name = "Someoneelse"
.."

Beta option
Struct...EndStruct 
Declare a variable with typed subelements

Other example:

func AClass($One='', $Two='')
 struct $AClass
  char One[256]
  char Two[256]
 endstruct
 $AClass.one = $One
 $AClass.two = $Two
 return $AClass
EndFunc

$MyClass = AClass('One',3)
MsgBox(0,'',$MyClass.one & '  ' & $MyClass.two)

$YourClass = AClass()
$YourClass.one = 2345.78
$YourClass.two = True
MsgBox(0,'',$YourClass.one & '  ' & $YourClass.two)

Valery
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.