Module writing hints: Difference between revisions

Jump to navigation Jump to search
*>SSH
(Added licensing section)
*>SSH
(Added dependency and naming collision sections)
Line 13: Line 13:


then, if you export the module and forget to remove the debug code, it won't affect the running of the module.
then, if you export the module and forget to remove the debug code, it won't affect the running of the module.
However, it is probably best if, before release, you always import a module into a fresh game so that you can check for any things like this, and other accidental dependencies.


== Calling a user-defined function from a module ==
== Calling a user-defined function from a module ==
Line 42: Line 44:


[http://creativecommons.org/license/ Creative commons] have a custom licence generator where you can choose the terms you want. Other suggested licences are the MIT/BSD licence, which only requires acknowledgement of the author, and the LGPL licence which requires any changes made to be pulbished as open source.
[http://creativecommons.org/license/ Creative commons] have a custom licence generator where you can choose the terms you want. Other suggested licences are the MIT/BSD licence, which only requires acknowledgement of the author, and the LGPL licence which requires any changes made to be pulbished as open source.
== Dependencies on GUIs ==
If your module depends on a particular GUI name, remember that AGS does a #define for GUI names, so that
    #ifndef MYGUI
will work. It's not foolproof, as a view with the same name might exist instead of the GUI, but its better than nothing.
== Name collisions ==
Beware of exporting any names from a module that are likely to be used as local variables in loops, whatever. This is why the [[Module programming guidelines]] sugegst prefixing them all with the module name, or using a struct, so that all exported identifiers are struct sub-members.