Jump to content
Sign in to follow this  
DreamVB

Array of Structures

Recommended Posts

hi, Is it possible to create an array of structures

I started yesterday to build a small lexical scanner, I am trying to build my own little toy scripting language that I will share with you all I already done the code that scans a file and breaks it up into tokens, but now I need a way to store this information I know in VB you use something like this, Example

Type TTOKEN
    TokType As Byte
    Token As Variant
End Type

Private Tokens(10) As TTOKEN

Tokens(0).TokType = 1 'cmd
Tokens(1).Token = "DIR"

Tokens(0).TokType = 2 'Num
Tokens(1).Token = 2

Is there a way to do something like this in autoit , My idea was maybe use two arrays one for TokTypes and the other for Tokens, but if there is a better way I also like to try that,

Anyway help will be very kind.

Thanks.


On Error Resume Pulling Hair Out.

Share this post


Link to post
Share on other sites

Hi.

Local $aArray[2]=[DllStructCreate("dword TokType;wchar Token[100]"),DllStructCreate("dword TokType;wchar Token[100]")]

$aArray[0].TokType=1
$aArray[0].Token="Hola"

$aArray[1].TokType=2
$aArray[1].Token="Mundo"

ConsoleWrite($aArray[0].TokType() & "    " & $aArray[0].Token() & @CRLF)
ConsoleWrite($aArray[1].TokType() & "    " & $aArray[1].Token() & @CRLF)

Saludos

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...