Advertisement

A few questions about fundamentals

Started by January 14, 2011 01:10 PM
25 comments, last by WitchLord 13 years, 8 months ago
Hi, Witchlord, I have another q.
I see that the "enum" is in the reserved area in the docs. But I didn't notice that I can declare enumerations script-side.
Is it a feature you only plan to implement, or am I miss something?
I would like to have java-like enumeration with automatic to_string() etc.
Enums are already supported from script side as well: http://www.angelcode.com/angelscript/sdk/docs/manual/doc_global.html#doc_global_enums I'll have a look at the java-style to_string() functionality. Maybe it is something I can add support for.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement
Thanks. I mean this http://download.orac...html#toString()
I'm sure 100% that since you compile script anyway it's a god blessing to provide automatic string generation for enums.
Otherwise, AS user will have to do some ugly mapping via string array or switch() to be able to print out the concrete constant in comprehendable form.
Hi, Witchlord.
I have a request regarding Template Types page of docs.
Can you write the exact code for myTemplateFactory function?
Thanks for the suggestion. I'll add this.


In the meantime, please see the implementation for the CScriptArray add-on.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Ok, I took a look at a script add-on carefully.
As I understand angelscript template types are just an emulation of template behavior for a script user, and they have no connection to c++ template class parametrisation.
So if I have
template <typename> class A{...}
and some instantiations of it like A<int>, A<float> etc. in c++
What is the best way to bind it to AngelScript?
Advertisement
This is correct. A C++ template doesn't really exist until you instanciate, so there is no way of registering it.

You register the C++ template instances just as you would a normal class.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement