Skip to main content
GameDev.net gamedev.net
✓ Solved 🔒 Locked

Templated function with value type assert

Started by sebight Mar 27 at 9:23 AM 2 replies 750+ views
Original Post
sebight
sebight

Hello, I know this might be a very niche edge case, but I still want to ask about it anyways.

I have a templated function called GetScript<T>.

When I do this:

MyScript@ script = self.GetScript<MyScript>(); it works fine.

However, when I would write this:

self.GetScript<int>() it crashes internally with this assert: asASSERT(dt.IsObjectHandle()) in as_scriptengine.cpp in the DetermineTypeForTemplate function.

I know this makes sense, but I would very much prefer if the build failed and compilation errors were reported. It is a user error that could be done in my engine and I want to avoid crashing from scripting as much as possible.

Thank you!

Accepted Answer

sebight wrote:

I know this makes sense, but I would very much prefer if the build failed and compilation errors were reported. It is a user error that could be done in my engine and I want to avoid crashing from scripting as much as possible.

You're right. It should definitely give a compiler error and not crash on incorrect usage.

I'll have it fixed as soon as possible.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - <a href="http://www.angelcode.com/tower" rel

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.