General Purpose Functions

Overview

use(name)

Makes the functions defined in the module “name” accessible in the global namespace. If the function use() is used in a separate file, its effect is limited to the file itself and the functions that it calls. When the function is used from the interactive shell, the global environment is affected.

As a special case When called with ‘strict’ as its argument the use of undeclared global variables will be checked. When active all global variables must be declared through a regular assignment (even assigning nil will do) in a main chunk before being used anywhere or assigned to inside a function.

The ‘strict’ mode is encouraged since it can prevent many common errors of unintentional use of global variables.

restore_env()

This function restores the original environment by removing the effect of all the use() calls made before.

gsl_type(x)

This function is an extension of the standard Lua function “type”. It does returns the same string of the “type” function except when the argument is a GSL object. When this happens it does return a string corresponding to its actual type instead of “userdata” or “cdata”. For complex number and real or complex matrix it does return respectively “complex”, “matrix” and “complex matrix”.

help(obj)

Print some help, if available, about the given object or function. In the first line it will be shown how the function should be called. If the function have some optional parameters these will be shown inside square brackets.

Table Of Contents

Previous topic

GSL Shell introduction

Next topic

Complex Numbers

This Page