A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
Simplifying and improving identification of tables
[simgrid.git]
/
src
/
bindings
/
lua
/
simgrid_lua.c
diff --git
a/src/bindings/lua/simgrid_lua.c
b/src/bindings/lua/simgrid_lua.c
index
2dbb971
..
611b475
100644
(file)
--- a/
src/bindings/lua/simgrid_lua.c
+++ b/
src/bindings/lua/simgrid_lua.c
@@
-522,7
+522,7
@@
static int run_lua_code(int argc, char **argv)
{
XBT_DEBUG("Run lua code %s", argv[0]);
- lua_State *L = sglua_clone_
state(lua_maestro_state
);
+ lua_State *L = sglua_clone_
maestro(
);
int res = 1;
/* start the function */
@@
-738,13
+738,30
@@
int luaopen_simgrid(lua_State *L)
/* initialize access to my tables by children Lua states */
lua_newtable(L);
- lua_setfield(L, LUA_REGISTRYINDEX, "simgrid.
visited
_tables");
+ lua_setfield(L, LUA_REGISTRYINDEX, "simgrid.
maestro
_tables");
register_c_functions(L);
return 1;
}
+/**
+ * @brief Returns whether a Lua state is the maestro state.
+ * @param L a Lua state
+ * @return true if this is maestro
+ */
+int sglua_is_maestro(lua_State* L) {
+ return L == lua_maestro_state;
+}
+
+/**
+ * @brief Returns the maestro state.
+ * @return true the maestro Lua state
+ */
+lua_State* sglua_get_maestro(void) {
+ return lua_maestro_state;
+}
+
/**
* Makes the appropriate Simgrid functions available to the Lua world.
* @param L a Lua world