[haXe] Using Type.typeof
John Eriksson
john at insane.se
Wed Aug 1 16:04:52 CEST 2007
Well... maybe I'm doing this all wrong from the start, if I am please
correct me :-)
What I want to do is just to check if a certain value that is passed
to a method is an
Object or not...
2007/8/1, Benjamin Dasnois <benjamin.dasnois at gmail.com>:
> Why do you want to use TObject? It's not really an haXe type...it's a
> runtime type. Is there any reason you really want to use it?
>
> On 8/1/07, John Eriksson <john at insane.se> wrote:
> > Yeah, that's what I was thinking too, yes the compiler complains if I
> > try to declare
> > a variable of type TObject... I just dont know how to include
> > TObject...how do I do that
> > with an import statement? Where is TObject declared? As far as I can
> > tell, the TObject
> > is declared in Type.hx, but Type is always available without an
> > import... shouldn't
> > TObject be as well? (TObject is a type declared by the haXe language).
> >
> > 2007/8/1, Benjamin Dasnois <benjamin.dasnois at gmail.com>:
> > > Maybe it works but you're using another function...
> > > Are you sure you've included what's necessary for your TObject type to
> > > be accessible? For example, does the compiler complains if you try to
> > > declare a variable of type TObject in the same function?!
> > >
> > >
> > >
> > > On 8/1/07, John Eriksson <john at insane.se> wrote:
> > > > I tried it, but it gives me this error when compiling:
> > > >
> > > > ../frameworks.git/InsaneFramework/se/insane/core/model/INSModelArray.hx:39:
> > > > characters 24-31 : Unknown identifier : TObject
> > > >
> > > > currently I am doing:
> > > >
> > > > if(Std.string(Type.typeof(fieldData)) == 'TObject')
> > > >
> > > > is that really how it is supposed to work?
> > > >
> > > > 2007/8/1, Benjamin Dasnois <benjamin.dasnois at gmail.com>:
> > > > > Hello,
> > > > > Try this :
> > > > > if (Std.is(fieldData, TObject))
> > > > > {
> > > > > //fieldData is of type TObject
> > > > > } else
> > > > > {
> > > > > //fieldData is not of type TObject
> > > > > }
> > > > >
> > > > > Regards,
> > > > > Benjamin DASNOIS
> > > > >
> > > > > On 8/1/07, John Axel Eriksson <john at insane.se> wrote:
> > > > > > If I'd like to compare the type of a value and check if it is
> > > > > > TObject, how would I do that?
> > > > > >
> > > > > >
> > > > > > I have tried:
> > > > > >
> > > > > > if ( Type.typeof(fieldData) == TObject )
> > > > > >
> > > > > > if ( Type.typeof(fieldData) == "TObject" )
> > > > > >
> > > > > > if ( Type.typeof(fieldData) == ValueType.TObject )
> > > > > >
> > > > > > and some other ways but none of these are correct. I guess this is a
> > > > > > simple one, but I can't seem to figure it out.
> > > > > >
> > > > > >
> > > > > > /J
> > > > > >
> > > > > > --
> > > > > > haXe - an open source web programming language
> > > > > > http://haxe.org
> > > > > >
> > > > >
> > > > > --
> > > > > haXe - an open source web programming language
> > > > > http://haxe.org
> > > > >
> > > >
> > > > --
> > > > haXe - an open source web programming language
> > > > http://haxe.org
> > > >
> > >
> > > --
> > > haXe - an open source web programming language
> > > http://haxe.org
> > >
> >
> > --
> > haXe - an open source web programming language
> > http://haxe.org
> >
>
> --
> haXe - an open source web programming language
> http://haxe.org
>
More information about the Haxe
mailing list