webmcp
diff libraries/mondelefant/mondelefant_native.c @ 415:0dff5e2f659c
Changed mondelefant_result_index C-function: lookup in _data table (regular columns) is done last; lookup in _data table is omitted if "document_column" attribute of class is set
author | jbe |
---|---|
date | Sat Jan 09 17:32:30 2016 +0100 (2016-01-09) |
parents | 015be25c98dd |
children | 046927075270 |
line diff
1.1 --- a/libraries/mondelefant/mondelefant_native.c Sat Jan 09 05:30:45 2016 +0100 1.2 +++ b/libraries/mondelefant/mondelefant_native.c Sat Jan 09 17:32:30 2016 +0100 1.3 @@ -1647,11 +1647,6 @@ 1.4 } 1.5 lua_settop(L, 3); 1.6 lua_getfield(L, 1, "_data"); // _data table on stack position 4 1.7 - // try normal data field info: 1.8 - lua_pushvalue(L, 2); // 5 1.9 - lua_gettable(L, 4); // 5 1.10 - if (!lua_isnil(L, 5)) return 1; 1.11 - lua_settop(L, 4); // keep _data table on stack 1.12 // try cached referenced object (or cached NULL reference): 1.13 lua_getfield(L, 1, "_ref"); // 5 1.14 lua_pushvalue(L, 2); // 6 1.15 @@ -1682,17 +1677,21 @@ 1.16 return 1; 1.17 } 1.18 lua_settop(L, 4); 1.19 - // try proxy access to document in special column: 1.20 + // check if proxy access to document in special column is enabled: 1.21 lua_getfield(L, 3, "document_column"); // 5 1.22 if (lua_toboolean(L, 5)) { 1.23 + // if yes, then proxy access: 1.24 lua_gettable(L, 4); // 5 1.25 if (!lua_isnil(L, 5)) { 1.26 lua_pushvalue(L, 2); // 6 1.27 lua_gettable(L, 5); // 6 1.28 - if (!lua_isnil(L, 6)) return 1; 1.29 } 1.30 + } else { 1.31 + // else use _data table: 1.32 + lua_pushvalue(L, 2); // 6 1.33 + lua_gettable(L, 4); // 6 1.34 } 1.35 - return 0; 1.36 + return 1; // return element at stack position 5 or 6 1.37 } else if (result_type && !strcmp(result_type, "list")) { // list 1.38 lua_settop(L, 3); 1.39 // try inherited list attributes or methods: