Re: [Gambas-user] How to test if result is an array

2012-03-17 Thread Benoît Minisini
Le 17/03/2012 18:48, Randall Morgan a écrit : > Tried that, didn't work. I got the same errors > Sorry, I gave you the Gambas 2 syntax. You must do: If TypeOf(Result) = gb.Object And If Result Is Array Then ... But why didn't you try the second solution? -- Benoît Minisini --

Re: [Gambas-user] How to test if result is an array

2012-03-17 Thread Randall Morgan
Tried that, didn't work. I got the same errors On Sat, Mar 17, 2012 at 10:45 AM, Emil Lenngren wrote: > You need to use "And If", not only "And". > http://gambasdoc.org/help/lang/andif?v3 > > /Emil > > 2012/3/17 Randall Morgan > > > Hi Benoit, > > > > I tried the code below and I get errors. If

Re: [Gambas-user] How to test if result is an array

2012-03-17 Thread Emil Lenngren
You need to use "And If", not only "And". http://gambasdoc.org/help/lang/andif?v3 /Emil 2012/3/17 Randall Morgan > Hi Benoit, > > I tried the code below and I get errors. If I use: > > if result Is Array Then > > I get a type error. > > If I use: > > if IsObject(result) And result Is Array Then

Re: [Gambas-user] How to test if result is an array

2012-03-17 Thread Randall Morgan
Hi Benoit, I tried the code below and I get errors. If I use: if result Is Array Then I get a type error. If I use: if IsObject(result) And result Is Array Then I get an identifier error IsObject unknown identifier. I just updated my code base and recompiled and still have these errors. I a

Re: [Gambas-user] How to test if result is an array

2012-03-16 Thread Randall Morgan
I'm using: gcc --version gcc (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1 Copyright (C) 2011 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. On this machine. I think I hav

Re: [Gambas-user] How to test if result is an array

2012-03-16 Thread Benoît Minisini
Le 16/03/2012 18:35, Randall Morgan a écrit : > I am aware of the warnings. But needed to check in my code so I would have > access to it from another location. You had told me before it was ok to > check in code that contained errors or was incomplete. I then got > distracted and also was hoping t

Re: [Gambas-user] How to test if result is an array

2012-03-16 Thread Randall Morgan
I am aware of the warnings. But needed to check in my code so I would have access to it from another location. You had told me before it was ok to check in code that contained errors or was incomplete. I then got distracted and also was hoping to hear back from on some of my questions. But never di

Re: [Gambas-user] How to test if result is an array

2012-03-16 Thread Benoît Minisini
Le 16/03/2012 04:14, Randall Morgan a écrit : > Hi, > > I am writing a small test suit and need to tell is the result I got back > from a function is an array of some type. > Does anyone have a solution for this? > > Thanks > You can do like that: Dim Result As Variant Result = T

Re: [Gambas-user] How to test if result is an array

2012-03-16 Thread Randall Morgan
You can see the code in the gb.gsl/test folder. However that code does not contain the code I am working on at the moment. I have not committed it yet. What I am trying to accomplish is to create a test framework that can be used for any type of data or object. So that the general framework is gen

Re: [Gambas-user] How to test if result is an array

2012-03-16 Thread Caveat
Hi, It's probably worth putting in a check for TypeOf(my_var) = gb.Object (16) before doing the Is Array check... (From the documentation): Expression type Return value NULL gb.Null=15 Boolean gb.Boolean=1 Byte gb.Byte=2 Short gb.Short=3 Integer gb.Integer=4 Long gb.Long=5

Re: [Gambas-user] How to test if result is an array

2012-03-16 Thread Randall Morgan
The line containing the if statement. It is the "Is" keyword that fail somehow If I change it to = or some other expression I get results I would expect. -> if expected Is Array Then ---> Error: "Expected Object got boolean" I am already using TypeOf to test the type of the results. What

Re: [Gambas-user] How to test if result is an array

2012-03-16 Thread Emil Lenngren
That kind of code should work, I think... On what line is the error? 2012/3/16 Randall Morgan > The code is for a test framework. I am currently on the wrong machine to > send the code. But it's something like this: > > Dim result As Variant > Dim expected As Variant > Dim i As Integer > Dim isE

Re: [Gambas-user] How to test if result is an array

2012-03-16 Thread Randall Morgan
The code is for a test framework. I am currently on the wrong machine to send the code. But it's something like this: Dim result As Variant Dim expected As Variant Dim i As Integer Dim isEqual As Boolean result = myFunction() As Variant if Typeof(result) = Typeof(expected) Then isEqual = Tru

Re: [Gambas-user] How to test if result is an array

2012-03-16 Thread Emil Lenngren
How does your code look like? A boolean is certainly not an array... :) /Emil 2012/3/16 Randall Morgan > That works as long as a is an array. But it a is an a boolean then I get an > error "Object expected but got boolean" or float, ect... > > I too thought it should work that way. Mybe there i

Re: [Gambas-user] How to test if result is an array

2012-03-16 Thread Randall Morgan
That works as long as a is an array. But it a is an a boolean then I get an error "Object expected but got boolean" or float, ect... I too thought it should work that way. Mybe there is a bug in the Gambas or my code? On Fri, Mar 16, 2012 at 3:34 AM, Emil Lenngren wrote: > Dim a As New String[

Re: [Gambas-user] How to test if result is an array

2012-03-16 Thread Emil Lenngren
Dim a As New String[] Print a Is Array should work I think... 2012/3/16 Randall Morgan > Hi, > > I am writing a small test suit and need to tell is the result I got back > from a function is an array of some type. > Does anyone have a solution for this? > > Thanks > > -- > If you ask me if it c

[Gambas-user] How to test if result is an array

2012-03-15 Thread Randall Morgan
Hi, I am writing a small test suit and need to tell is the result I got back from a function is an array of some type. Does anyone have a solution for this? Thanks -- If you ask me if it can be done. The answer is YES, it can always be done. The correct questions however are... What will it cos