Thank you Anomie, it helped me a lot. I'm sorry I missed the information in the manual.

Le 25/09/2017 à 22:21, Brad Jorsch (Anomie) a écrit :
On Mon, Sep 25, 2017 at 4:04 PM, mathieu stumpf guntz <
[email protected]> 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.loadData



_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to