Sign in to follow this  
SiddharthBhat

Multiple Definiton in Angelscript

Recommended Posts

Hi all!

 

I'm finding it more and more annoying that on binding the same function twice to angelscript, it just dosen't give you a sensible warning. Angelscript doesn't warn you when you register then function the 2nd time, but rather tells you that there are "multiple matching signatures" to the function. I just spent a whole day looking for an alternate signature, after which I realized I was binding the function twice.

 

is there some sort of flag that we can send to AS_Engine that notifies us on registering a function twice? (Sure, there will be some overhead in checking this, maybe O(n) if we do a linear search, or O(1) if we decide to hash the string. That's why we could have a flag that lets us control this). Or is there some other way to figure out if a function (or a class) is being bound twice? (BTW, binding a class twice gives some weird errors. Angrlscript starts complaining about the destructor of the class that the behavior I'm trying to register is invalid. It also doesn't let you instantiate the class properly. I guess this maybe the accepted behavior? )

 

but it would be really nice to have some sort of a feature like this. Heck, I'd be happy to implement it if you told me where to modify the code.

 

/rant

 

Thanks.

~Bollu.

 

PS- English isn't my first language, so do correct me if I've made some sort of mistake :)

Share this post


Link to post
Share on other sites

Hmm. The engine is supposed to check against registering duplicate functions, methods, and types. The registration function should return an error (you do check the return codes, don't you?), and if you ignore that error and try to compile a script anyway you'll get an "Invalid configuration" error.

 

Can you give examples? Perhaps there is some bug that makes the code not see the duplicates.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this