- lua_State* father = sglua_get_father(dst);
-
- if (father != NULL && src != father && sglua_get_father(src) == father) {
- XBT_DEBUG("%sGet the metatable from my father",
- sglua_get_spaces(indent));
- /* I don't want the metatable of src, I want the father's copy of the
- same metatable */
-
- /* get from src the pointer to the father's copy of this metatable */
- lua_pushstring(src, "simgrid.father_visited_tables");
- /* src: ... udata mt "simgrid.visited_tables" */
- lua_rawget(src, LUA_REGISTRYINDEX);
- /* src: ... udata mt visited */
- lua_pushvalue(src, -2);
- /* src: ... udata mt visited mt */
- lua_gettable(src, -2);
- /* src: ... udata mt visited pfathermt */
-
- /* copy the metatable from the father world into dst */
- lua_pushstring(father, "simgrid.visited_tables");
- /* father: ... "simgrid.visited_tables" */
- lua_rawget(father, LUA_REGISTRYINDEX);
- /* father: ... visited */
- lua_pushlightuserdata(father, (void*) lua_topointer(src, -1));
- /* father: ... visited pfathermt */
- lua_gettable(father, -2);
- /* father: ... visited mt */
- sglua_move_value_impl(father, dst, "(father metatable)");
- /* father: ... visited
- dst: visited ... udata mt */
- lua_pop(father, 1);
- /* father: ... */
- lua_pop(src, 3);