How to use Object.typeName() method?

About Monkey 2 Forums Monkey 2 Programming Help How to use Object.typeName() method?

This topic contains 2 replies, has 1 voice, and was last updated by  nerobot 2 years, 7 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #3627

    nerobot
    Participant

    I need to get type of objects as string value.

    I looked into monkey module and found method typeName() in Object class, but it returns ‘Void Ptr’ type. Also there is a function TypeName that converts CString into String.

    How to get simple String type?

    If I just add this code line

    then I got compiler error

    #3628

    nerobot
    Participant

    I solved it by adding method

    into Object class and rebuilding module.

    Now I get types like this:

    by simple call of myObj.GetType().

    This is what I need! 🙂

    #3632

    nerobot
    Participant

    Another question: how to get type if I have only class name but not instance?

    In java it’s ClassName.class keyword, but it’s a part of reflection.

    What I d0:

    I think I can use an inner structure with stack like in ted2.Plugin class, but it’s kind of magic for me how it extract data with our template type only.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.