Gamepedia Help Wiki
Advertisement

#listmerge

I'm having trouble understanding this function. From the code {{#listmerge:list=a, b, c|token1=$token1$|token2=$token2$|matchpattern=<esc>{{#ifeq:$token1$|a|{{#ifeq:$token2$|c|yes}}}}</esc>|mergepattern=Z}} I was expecting the output Z, b. What I'm taking from the documentation here and the source code is that the function creates the pairs ab, ac, and bc and merges a pair if it matches the matchpattern. So my code above should match the ac pair and should merge both list elements into mergepattern, Z. However, the code displays the unchanged input list a, b, c. What am I doing wrong? Could someone please provide an example of how to use this function? --Rye Greenwood (talk) 16:08, 5 April 2021 (UTC)

Just looked into this, and the function has a bug in that it doesn't correctly handle an empty fieldsep. That's causing a couple errors that are preventing the merge logic from running. For now, this can be worked around by specifying some nonsense fieldsep, like say the backtick character, that isn't likely to be used within the list items. SBEyes (talk) 17:07, 5 April 2021 (UTC)
I see; thanks for the quick answer! --Rye Greenwood (talk) 17:13, 5 April 2021 (UTC)
Advertisement