Hallo.
I have a variable
oVar
Then I have an Array and another object:
aArray := [ 1 ]
oObject := InputHook( ... )
Then I can assign it:
oVar := aArray
or
oVar := oObject
Now I need to recognize if oVar contain the array or the other object: is it possible?
Distinguish between Array and another object
Re: Distinguish between Array and another object
Code: Select all
#Requires AutoHotkey v2.0
aArray := [ 1 ]
oObject := InputHook('L1')
oVar := oObject ; aArray
Try
MsgBox oVar.Has(1) && 'Array'
Catch
MsgBox 'Input object'
Re: Distinguish between Array and another object
Why not use Type(var)?
Re: Distinguish between Array and another object
Ah, yes. I keep forgetting we have that now.
Re: Distinguish between Array and another object
Type( var )
is very interesting, but is not enough documented on the AutoHotkey manual.
I found this possible return values by Type( var ):
If anyone know other possible values, please write it here.
is very interesting, but is not enough documented on the AutoHotkey manual.
I found this possible return values by Type( var ):
Code: Select all
; "Integer" ; Variable containing an Integer Number.
; "Float" ; Variable containing a Floating point Number or Exponential Number.
; "String" ; Variable containing a String.
; "InputHook" ; Object generated by InputHook( ... )
; "Array" ; Object Sequential Array ( array defined by Array() function ).
; "Map" ; Object Associative Array ( array defined by Map() function ).