[Gambas-user] Array with multiple types of vars

Demosthenes Koptsis demosthenesk at ...626...
Wed Jun 13 14:43:44 CEST 2012


yes that i wanted,

a public array with different types of elements.
so it can
MyArray[0] = 1
MyArray[1] = 1.2
MyArray[2] = "string"
MyArray[3] = TRUE

thanks.


Στις 12/6/2012 12:28, ο/η Emil Lenngren έγραψε:
> You can create a Variant[] that can contain arbitrary data types. You
> can store a reference to that array both in a .Tag field, and some
> other global variable.
>
> Public MyArray As Variant[]
>
> and in your code:
> MyArray = [1, 2, "yeah"]
> something.Tag = MyArray
>
> 2012/6/12, Bruce<bbruen at ...2308...>:
>> On Tue, 2012-06-12 at 09:38 +0300, Demosthenes Koptsis wrote:
>>> Hi,
>>>
>>> in server socket example i see that we use the Tag property as an array
>>>
>>> i changed it a while....
>>>     Obj.Tag = [$iId, 0, "", False, sHost] 'Client id, Data id, Data,
>>> Valid Client, Remote Ip
>>>
>>> My question is, can i make such arrays [$iId, 0, "", False, sHost] at
>>> Global scope Private/Public arrays?
>>>
>>> i want to create an array like
>>> [Integer, Integer, String, Boolean, String]
>>>
>>> How can i do that?
>> You mean like:
>>
>> Private $MyArray as Variant[]
>>
>> ???
>>
>> or do you want to "enforce" some strong typing on the individual
>> entries?  I don't think you can do that.
>>
>> Bruce
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and
>> threat landscape has changed and how IT managers can respond. Discussions
>> will include endpoint security, mobile security and the latest in malware
>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>> _______________________________________________
>> Gambas-user mailing list
>> Gambas-user at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user





More information about the User mailing list