+/**
+ * @brief Removes a reference to a maestro table to the list of known maestro
+ * tables of a state.
+ *
+ * @param L a state (can be maestro itself)
+ * @param index index of the copy of the maestro table in the stack of L
+ * @param maestro_table_ptr pointer to the original table in maestro's world
+ */
+static void sglua_remove_maestro_table(lua_State* L, int index, void* maestro_table_ptr) {
+
+ /* we will unset both [ptr] -> table and [table] -> ptr */
+
+ /* ... */
+ lua_pushvalue(L, index);
+ /* ... table */
+ lua_pushstring(L, "simgrid.maestro_tables");
+ /* ... table "simgrid.maestro_tables" */
+ lua_rawget(L, LUA_REGISTRYINDEX);
+ /* ... table maestrotbs */
+ lua_pushvalue(L, -2);
+ /* ... table maestrotbs table */
+ lua_pushnil(L);
+ /* ... table maestrotbs table nil */
+ lua_pushlightuserdata(L, maestro_table_ptr);
+ /* ... table maestrotbs table nil tableptr */
+ lua_pushnil(L);
+ /* ... table maestrotbs table nil tableptr nil*/
+ lua_settable(L, -5);
+ /* ... table maestrotbs table nil */
+ lua_settable(L, -3);
+ /* ... table maestrotbs */
+ lua_pop(L, 2);
+ /* ... */
+}
+