webmcp

changeset 547:75fd8869bc4e

Further bugfixes regarding 1:1 references
author jbe
date Sat Oct 19 20:45:35 2019 +0200 (2019-10-19)
parents d5bad374641e
children a006593b747c
files libraries/mondelefant/mondelefant.lua libraries/mondelefant/mondelefant_native.c
line diff
     1.1 --- a/libraries/mondelefant/mondelefant.lua	Sat Oct 19 20:23:28 2019 +0200
     1.2 +++ b/libraries/mondelefant/mondelefant.lua	Sat Oct 19 20:45:35 2019 +0200
     1.3 @@ -1514,6 +1514,7 @@
     1.4    end
     1.5    self.references[ref] = {
     1.6      mode     = mode,
     1.7 +    primary  = primary,
     1.8      this_key = this_key,
     1.9      that_key = connected_by_table and "mm_ref_" or that_key,
    1.10      ref      = ref,
     2.1 --- a/libraries/mondelefant/mondelefant_native.c	Sat Oct 19 20:23:28 2019 +0200
     2.2 +++ b/libraries/mondelefant/mondelefant_native.c	Sat Oct 19 20:45:35 2019 +0200
     2.3 @@ -1788,9 +1788,11 @@
     2.4          if (lua_toboolean(L, 8)) {
     2.5            if (!lua_isnil(L, 3)) {
     2.6              // set backward reference:
     2.7 -            lua_getfield(L, 6, "backref");  // 9
     2.8 -            lua_pushvalue(L, 1);  // 10
     2.9 -            lua_settable(L, 3);
    2.10 +            lua_getfield(L, 6, "back_ref");  // 9
    2.11 +            if (lua_toboolean(L, 9)) {
    2.12 +              lua_pushvalue(L, 1);  // 10
    2.13 +              lua_settable(L, 3);
    2.14 +            }
    2.15            }
    2.16            // do nothing else:
    2.17            return 0;
    2.18 @@ -1811,9 +1813,11 @@
    2.19          if (!lua_isnil(L, 3)) {
    2.20            // store object in other _ref table (use false for nil):  // TODO: use special object instead of false
    2.21            lua_getfield(L, 3, "_ref");  // 7
    2.22 -          lua_getfield(L, 6, "backref");  // 8
    2.23 -          lua_pushvalue(L, 1);  // 9
    2.24 -          lua_settable(L, 7);
    2.25 +          lua_getfield(L, 6, "back_ref");  // 8
    2.26 +          if (lua_toboolean(L, 8)) {
    2.27 +            lua_pushvalue(L, 1);  // 9
    2.28 +            lua_settable(L, 7);
    2.29 +          }
    2.30          }
    2.31        }
    2.32        lua_settop(L, 6);

Impressum / About Us