Main index  |  Module description  |  Classes

ClassModule

class Module

Handle to loaded modules. more...


Member list

Methods
engineVersion Returns the version numbers of the compilation engine.
get Retreives a value from the target module.
getReference Retreives a value from the target module.
moduleVersion Returns the version numbers of the module.
set Changes a value in the target module.
unload Removes the module from the running virtual machine.

Detailed description

The module class is a handle by which the scripts can read or write other modules symbols. It should not be instantiated directly by scripts; module class instances are returned by the Compiler methods.


Class methods

engineVersion()

Returns the version numbers of the compilation engine.

Module.engineVersion( )
Returns:

A three element array containing version, subversion and patch number.

Returns an array of three numeric elements, indicating the version number of the engine under which the given module was compiled. The value is available both for binary modules and for pre-compiled Falcon modules. Modules compiled on the fly will report the same version number of the running Virtual Machine.

get()

Retreives a value from the target module.

Module.get( symName )
symName

The name of the symbol to be loaded.

Raises:
AccessError

if the symbol name is not found.

If the module provides a global symbol with the given name, the value of the symbol is returned. Nil may be a valid return value; in case the symbol is not found, an AccessError is raised.

getReference()

Retreives a value from the target module.

Module.getReference( symName )
symName

The name of the symbol to be referenced.

Returns:

A reference to the desired item.

Raises:
AccessError

if the symbol name is not found.

Loads a reference to the given symbol in the target module. On success, after this call assignments to the returned variable will be immediately reflected in both the modules, be them applied in the caller or in the loaded module. To break the reference, use the $0 operator as usual.

In case the symbol is not found, an AccessError is raised.

moduleVersion()

Returns the version numbers of the module.

Module.moduleVersion( )
Returns:

A three element array containing version, subversion and patch number.

Returns the module version information in a three element array. The numbers represent the development status of the module as its developers advertise it.

Version informations for scripts compiled on the fly and for .fam modules are provided through the "version" directive.

set()

Changes a value in the target module.

Module.set( symName, value )
symName

The name of the symbol to be changed.

value

The new value to be set.

Raises:
AccessError

if the symbol name is not found.

Sets the value of a global symbol in the target module. The value may be any kind of Falcon item, including a reference, in which case any change to the local value is immediately reflected in the target module.

In case the symbol is not found, an AccessError is raised.

unload()

Removes the module from the running virtual machine.

Module.unload( )
Returns:

True on success, false on failure.

Unloads the module, eventually destroying it when there aren't other VMs referencing the module.

References to callable items that resided in the module becomes “ghost”. They are turned into nil when trying to use them or when the garbage collector reaches them; so, trying to call a function that resided in an unloaded module has the same effect as calling a nil item, raising an error.


Main index  |  Module description  |  Classes
Made with Faldoc 1.0.0