Advertisement

Define a global variable across all scripts

Started by July 29, 2011 09:10 PM
2 comments, last by WitchLord 13 years, 4 months ago
Is it possible to define a variable in "Script A" and access it in "Script B" which is in a different module?
It is not possible to access the global variable directly across modules, but you can import functions from the other module that will allow you read and write access to the variable indirectly.

Regards,
Andreas

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
How would this work for classes themselves across modules? Do we just import the constructor/factory function or something?
A class compiled in one module cannot be used directly by the other module, even if the class has been compiled in both modules from the same source code. However, interfaces can be directly shared, so if the class implements an interface known by both modules you can pass a handle to the interface to the other module so it can manipulate the object.

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