On Mon, Sep 25, 2017 at 4:04 PM, mathieu stumpf guntz < psychoslave@culture-libre.org> wrote:
Hi, I have some trouble trying to concatenate an array stored in a Scribunto data module.
mw.logObject(p.data().voir_aussi) table#1 { metatable = table#2 "NU", "nú", "nụ", "nư", "nữ", "ñu", "ňu", ".nu", "nu!", } =table.concat(p.data().voir_aussi) == '' -- true
This is mentioned in the reference manual:[1]
- The table actually returned by mw.loadData() has metamethods that provide read-only access to the table returned by the module. Since it does not contain the data directly, pairs() and ipairs() will work but other methods, including #value, next(), and the functions in the Table library, will not work correctly.
You'll have to copy the data into a real table before concatenating, or concatenate manually. The former is likely faster if the table will have many elements in it.
[1]: https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#mw.l...