Advertisement

How to use the same class in difference modules ?

Started by April 09, 2008 12:46 AM
1 comment, last by zopenge 16 years, 7 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!!!
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

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

This topic is closed to new replies.

Advertisement