Jump to content
  • Advertisement
Sign in to follow this  
kaveldun

Getting rid of Angelscript prints

This topic is 1724 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello!

 

I want to do my own error handling for when Angelscript functions fail. In most cases this is really easy by just checking the return value. However it seems like there is one case where I am getting an error print from Angelscript when I would rather want to take care of it myself. Here is the code in question:

 

asIObjectType* ScriptModule::getObjectTypeByDecl(const std::string& decl)
{
    std::cout << "Type declaration: " << decl << "\n";
    auto id = mAsModule->GetTypeIdByDecl(decl.c_str());
    std::cout << "Id: " << id << "\n";


    if(id < 0)
    {   
        std::cout << "Returning null!\n";
        return nullptr;
    }   


    auto thing = mEngine.getEngine()->GetObjectTypeById(id);
    std::cout << "Thing is: " << thing << "\n";


    return thing;
}

If I provide this function with a type that does not exist, "Elphant" instead of "Elephant" for instance, I get the following output:

 

Type declaration: Elphant
 (1, 1) : error : Identifier 'Elphant' is not a data type
Id: -12
Returning null!

So it seems like everything works as expected, except that the function not only returns -12 as the error, but also gives this debug print which is unwanted. Is there a particular reason for this? Am I doing it the wrong way? If not, can I get rid of the print somehow?

 

Share this post


Link to post
Share on other sites
Advertisement
This is a mistake. The library should not write any message to the application in this case. I'll have it fixed as soon as I can.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!