Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

LUA libraries
[Basic Components]


Detailed Description

LUA libraries.

LUA libraries are LUA scripts or chunks (lua compiled files) executed with the dofile() function. To complete successfully a library must return 1. Loading a lua library is performed by the dolib() function. This function handles proper library loading. It consists on :

Author:
benjamin gerard


Functions

 loadlib (var name, var libpath)
 Load a lua library.

 dolib (var name, var force, var libpath)
 Load a lua library.


Variables

string LIBRARY_PATH []
 Default lua library pathes.

string loaded_libraries []
 Global loaded library table.


Function Documentation

loadlib var  name,
var  libpath
 

Load a lua library.

For each path stored in the libpath table, the loadlib function calls a dofile({PATH}/{NAME}.lua). It stops if the library loads properly and returns a non nil value. On success, the loaded_libraries[{NAME}] is set to 1 and the full-path is returned. On failure, the loaded_libraries[{NAME}] is unset and the function returns nil. Before starting the search, loaded_libraries[{NAME}] is set to 2. This is special value used by dolib() function to avoid circular reference.

Parameters:
name lua library nude name (no path, no extension).
libpath table containing librairy search path.
Returns:
library full pathname.
Return values:
nil on error.

dolib var  name,
var  force,
var  libpath
 

Load a lua library.

Parameters:
name nude filename of lua library to load.
force library is reload even if library is loading or loaded.
libpath path or pathes table. nil defaulted to LIBRARY_PATH.
Returns:
boolean
Return values:
nil on error
See also:
loadlib()


dcplaya documentation version 2.0 Generated on November 2004 by doxygen 1.3.6