lua_loadlib.h File Reference

Lightweight C interface to the package loader. More...

Detailed Description

Lightweight C interface to the package loader.

Author
Juan Carrano j.car.nosp@m.rano.nosp@m.@fu-b.nosp@m.erli.nosp@m.n.de

Definition in file lua_loadlib.h.

Go to the source code of this file.

#define LUAR_MODULE_NOTFOUND   50
 Error code for when a modules is not found. More...
 
int lua_riot_getloader (lua_State *L, const char *name)
 Load a module as a chunk. More...
 

Macro Definition Documentation

◆ LUAR_MODULE_NOTFOUND

#define LUAR_MODULE_NOTFOUND   50

Error code for when a modules is not found.

The numeric value is chosen so that there is no collision with Lua's own error codes.

Definition at line 31 of file lua_loadlib.h.

Function Documentation

◆ lua_riot_getloader()

int lua_riot_getloader ( lua_State *  L,
const char *  name 
)

Load a module as a chunk.

This function is a lightweight "require". It does not require the "package" module to be loaded and does not register the module. Only the builtin tables are searched.

Upon sucessful execution, the compiled chunk will be at the top of the lua stack.

Parameters
LInitialized Lua interpreter state.
nameName of the module.
Returns
Same as lua_load. If the module is a C-module, then this will always succeed and return LUA_OK.