Jump to content
  • Advertisement
Sign in to follow this  
kaveldun

Getting rid of Angelscript prints

This topic is 2089 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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!