Jump to content
  • Advertisement
Sign in to follow this  
coollofty

Who can give some examples about asIScriptAny?

This topic is 4789 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

My question very simple: What is the asIScriptAny and asIScriptGeneric interface mean? When and how to use them? I cannot found any stuff about them in documents :(

Share this post


Link to post
Share on other sites
Advertisement
append a new question: :)
Im now working for a angelscript common library and a coloring edit with compiler and debuger. But some of the common functions need use the string type. Yes, I can very easely register a string factory for these common functions. But someone registered owner string factory then they how to use my common library?

Share this post


Link to post
Share on other sites
The asIScriptAny is an interface to the script 'any' type. The 'any' type is a generic container that can currently store any object handle. In the future it will be able to store all types, not just object handles.

You can see an example of how this works in the sample 'CoRoutines'.

---

The asIScriptGeneric interface can be used when you cannot register a function with a native calling convention. The function should then be a cdecl function that takes a pointer to the asIScriptGeneric interface, and the arguments passed by the script to the function are accessed through the interface.

It's mostly used when portability is a major concern for the application. If the AngelScript is compiled with the AS_MAX_PORTABILITY flag defined (see as_config.h), the only calling convention that can be used to register application functions is the asCALL_GENERIC, which uses the asIScriptGeneric interface to work.

I currently don't have a sample that shows how the asIScriptGeneric interface works, but you can look at the test case 'test_generic.cpp'.

---

As for your question about strings; Since the library can only handle 1 string type at a time your common functions and the application that uses them will have to agree upon which type to use. Perhaps you could supply different versions of your common functions that uses the common string types.

If your common functions is able to work with only std::string references for parameters and return values, then the application will be able to choose whether to register the std::string or asCScriptString (which is a wrapper for std::string). At least that way you give a little choice to the application.

Regards,
Andreas

PS. Sorry about the lack of documentation. I intend to improve that with future releases, though the improvement rate will probably be a slow.

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!