SimGrid  3.20
Versatile Simulation of Distributed Systems
simgrid_lua.cpp File Reference
#include "lua_private.hpp"
#include "lua_utils.hpp"
#include "src/surf/xml/platf.hpp"
#include <lauxlib.h>

Functions

 XBT_LOG_NEW_DEFAULT_CATEGORY (lua, "Lua Bindings")
 
int luaopen_simgrid (lua_State *L)
 Opens the simgrid Lua module. More...
 
static int debug (lua_State *L)
 Prints a log string with debug level. More...
 
static int info (lua_State *L)
 Prints a log string with info level. More...
 
static int error (lua_State *L)
 
static int critical (lua_State *L)
 
static int dump (lua_State *L)
 Dumps a lua table with XBT_DEBUG. More...
 
static void sglua_register_core_functions (lua_State *L)
 Makes the core functions available to the Lua world. More...
 

Variables

static const luaL_Reg simgrid_functions []
 

Function Documentation

◆ XBT_LOG_NEW_DEFAULT_CATEGORY()

XBT_LOG_NEW_DEFAULT_CATEGORY ( lua  ,
"Lua Bindings"   
)

◆ luaopen_simgrid()

int luaopen_simgrid ( lua_State *  L)

Opens the simgrid Lua module.

This function is called automatically by the Lua interpreter when some Lua code requires the "simgrid" module.

Parameters
Lthe Lua state

◆ debug()

static int debug ( lua_State *  L)
static

Prints a log string with debug level.

Parameters
La Lua state
Returns
number of values returned to Lua
  • Argument 1 (string): the text to print

◆ info()

static int info ( lua_State *  L)
static

Prints a log string with info level.

Parameters
La Lua state
Returns
number of values returned to Lua
  • Argument 1 (string): the text to print

◆ error()

static int error ( lua_State *  L)
static

◆ critical()

static int critical ( lua_State *  L)
static

◆ dump()

static int dump ( lua_State *  L)
static

Dumps a lua table with XBT_DEBUG.

This function can be called from within lua via "simgrid.dump(table)". It will then dump the table via XBT_DEBUG

◆ sglua_register_core_functions()

static void sglua_register_core_functions ( lua_State *  L)
static

Makes the core functions available to the Lua world.

Parameters
La Lua world

Variable Documentation

◆ simgrid_functions

const luaL_Reg simgrid_functions[]
static
Initial value:
= {
{"dump", dump},
{"debug", debug},
{"info", info},
{"critical", critical},
{"error", error},
{nullptr, nullptr}
}
static int dump(lua_State *L)
Dumps a lua table with XBT_DEBUG.
Definition: simgrid_lua.cpp:72
static int info(lua_State *L)
Prints a log string with info level.
Definition: simgrid_lua.cpp:45
static int critical(lua_State *L)
Definition: simgrid_lua.cpp:59
static int error(lua_State *L)
Definition: simgrid_lua.cpp:52
static int debug(lua_State *L)
Prints a log string with debug level.
Definition: simgrid_lua.cpp:31