# HG changeset patch # User jbe # Date 1571510735 -7200 # Node ID 75fd8869bc4eab36c16fc3eee94eeedf08a2a16b # Parent d5bad374641e5f666bf0244ae050fe0f524de13b Further bugfixes regarding 1:1 references diff -r d5bad374641e -r 75fd8869bc4e libraries/mondelefant/mondelefant.lua --- a/libraries/mondelefant/mondelefant.lua Sat Oct 19 20:23:28 2019 +0200 +++ b/libraries/mondelefant/mondelefant.lua Sat Oct 19 20:45:35 2019 +0200 @@ -1514,6 +1514,7 @@ end self.references[ref] = { mode = mode, + primary = primary, this_key = this_key, that_key = connected_by_table and "mm_ref_" or that_key, ref = ref, diff -r d5bad374641e -r 75fd8869bc4e libraries/mondelefant/mondelefant_native.c --- a/libraries/mondelefant/mondelefant_native.c Sat Oct 19 20:23:28 2019 +0200 +++ b/libraries/mondelefant/mondelefant_native.c Sat Oct 19 20:45:35 2019 +0200 @@ -1788,9 +1788,11 @@ if (lua_toboolean(L, 8)) { if (!lua_isnil(L, 3)) { // set backward reference: - lua_getfield(L, 6, "backref"); // 9 - lua_pushvalue(L, 1); // 10 - lua_settable(L, 3); + lua_getfield(L, 6, "back_ref"); // 9 + if (lua_toboolean(L, 9)) { + lua_pushvalue(L, 1); // 10 + lua_settable(L, 3); + } } // do nothing else: return 0; @@ -1811,9 +1813,11 @@ if (!lua_isnil(L, 3)) { // store object in other _ref table (use false for nil): // TODO: use special object instead of false lua_getfield(L, 3, "_ref"); // 7 - lua_getfield(L, 6, "backref"); // 8 - lua_pushvalue(L, 1); // 9 - lua_settable(L, 7); + lua_getfield(L, 6, "back_ref"); // 8 + if (lua_toboolean(L, 8)) { + lua_pushvalue(L, 1); // 9 + lua_settable(L, 7); + } } } lua_settop(L, 6);