Sign in to follow this  
Lbas

Features request

Recommended Posts

Hi, here're some features request (I know, I still didn't tried implicit casting one and I come back with new requests :)) : 1) Aliases : it would be great to be able to declare aliases for classes, methods, members, etc. My use here (but it should also be used for other purposes) would be to preserve backward compatibility between releases (for example, I want to rename a class from cPoint to cCoord whilst preserving compatibily to cPoint class until script writers upgrades their scripts). I know I could declare both classes, but I would then require to declare all members/methods twice. This request is not a high priority yet (as it's possible to make it working using other ways). 2) Variable argument list (va_list like) : my goal here is not necessarily to declare script function with variable arguments (even if it could be great too), but at least to be able to get variable list in C++ code. For example, we could have a string.Printf( ... ) method in the c++ part which would allow to format texts easier in the script part (such as myString.Printf( "value= %d", myValue ). Best Regards, Lbas

Share this post


Link to post
Share on other sites
No worries, anyone can make feature requests [smile]

1) Some form of aliases or typedefs are planned for a future release. I can't say when though.

2) AngelScript will not support variable argument lists in script functions, as it is not safe. It would require a completely different way of passing arguments.

You can however register C functions that take variable argument lists, but you'll have to declare all the parameters that AngelScript should send.

Class methods with variable argument lists are not supported, as they use a different calling convention than asCALL_THISCALL.

Regards,
Andreas

Share this post


Link to post
Share on other sites
1) Use my preprocessor. It's on the angelscript website. (Just be careful with including stuff. The inclusion guard is fatally flawed)

2) Register a collection class, like vector, and pass it instead.

Share this post


Link to post
Share on other sites
1) that's a solution, but I wanted to write aliases from the application part, not in the scripts.

2) Ok, thanks for the tip. Anyway, it would very more user friendly (for the script writers) to be able to declare a variable parameters functions, I'll have a look at what it would imply.

Thx for the tips.
Lbas

Share this post


Link to post
Share on other sites
You can use the collection class in angelscript. Perhaps with a binding of boost::any and some simple list iteration you can emulate va_args. The multiple arguments system in C/C++ is essentially a hack anyway.

The any class may be foiled by having to register explicitly for every type the script uses.

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