Jump to content

  • Log In with Google      Sign In   
  • Create Account

- - - - -

Modules / Imports?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 thewavelength   Members   -  Reputation: 109

Like
0Likes
Like

Posted 20 July 2012 - 06:03 AM

Hello everybody,

I'm fairly new to AS and I've read to the whole documentation twice to get a feeling for the design and the patterns.
But there are two very important questions that were not answered:

1.) Is there module functionality? E. g. like in scripting languages as Python? I think I've read somewhere in the documentation that it is there, but I can't find any examples. I've also read somewhere that it is not possible to share variables through modules even when they are in the same context / execution environment. But this is a feature I need. What do you do for example, if you have such a large script, that it is impossible to structure it in one file? This is some times the case for my needs.

2.) What exactly is an "import"? I've read somewhere that you can "import" functions. Is this the same as using modules?

I'm thankful for answers!

Sponsor:

#2 Andreas Jonsson   Moderators   -  Reputation: 3444

Like
1Likes
Like

Posted 20 July 2012 - 11:04 AM

Manual: Overview

A "module" in AngelScript is like a program or shared library in normal programming languages. Each "module" is compiled from one or more script files (called "sections"). All script files in the same module see the full content of each other, so there is no need for header files and the likes.

Two or more modules can be linked through the application. The "import" feature for example allow one module to say it wants to use a function from another module. The scripts can also declare functions or classes as "shared", which will allow the application to pass instances of these shared classes from one module to another.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#3 thewavelength   Members   -  Reputation: 109

Like
0Likes
Like

Posted 20 July 2012 - 11:53 AM

Wow, thanks. Now I've understood. But it isn't possible to pass e. g. integer variables between modules, is it?

Btw: I'd suggest to post exactly the text you've posted to the documentation. It's a bit more clear in my opinion.

#4 Andreas Jonsson   Moderators   -  Reputation: 3444

Like
0Likes
Like

Posted 20 July 2012 - 04:08 PM

Primitives, like integers, float, etc, can be passed between modules. However, the application is responsible for establishing the communication channels between the modules, which can be through the "import" feature, or message queues, or any other way that is the most convenient for the application. By default one module in AngelScript doesn't "see" any other module. The module only "sees" what the application registers in the engine interface.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS