🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

How to use the same class in difference modules ?

Started by
1 comment, last by zopenge 16 years, 2 months ago
A Module : had built class C ( use it in script ) B Module : had built class C ( use it in script ) I want to only build class C for only once. A and B Module could use class C both :) How to do it ? Is AddScriptSection() set module parameter to NULL value ? or some interfaces for setting it ? thanks!!!
Advertisement
Building a module with the module name set to NULL is no different from a module with a name, except that it has no name.

If the same script class is declared in two different modules AngelScript will treat it as two different classes.

If you want to use one script class that can be accessed from both modules, you'll have to have it implement an interface that is registered from the engine so that both modules share it. Then you'll have to write a factory function for creating the script class instances that the modules can access.


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

Thanks ! I will try to use interface for sharing object :)

This topic is closed to new replies.

Advertisement