Last modified: 2014-10-25 19:00:57 UTC
It's impossible to convert the statement "frame:preprocess('{{#switch:' .. v .. '|red|orange=1|yellow|green=2|blue|indigo=3|violet=4|5}}')" to use frame:callParserFunction. Here are two attempts that don't work: frame:callParserFunction('#switch', {v, 'red', 'orange=1', 'yellow', 'green=2', 'blue', 'indigo=3', 'violet=4', '5'}) This one doesn't work because the values aren't split at the equals sign, which isn't a bad thing. frame:callParserFunction('#switch', {v, 'red', orange='1', 'yellow', green='2', 'blue', indigo='3', violet='4', '5'}) This one doesn't work because Lua can't maintain order in an associative array, which is the cause of this bug. To fix this, I propose the following new syntax: frame:callParserFunction('#switch', {v, 'red', {'orange', '1'}, 'yellow', {'green', '2'}, 'blue', {'indigo', '3'}, {'violet', '4'}, '5'}) Although only parser functions can "see" order like this, I also propose that for consistency's sake, all brace-substitution functions (newChild, expandTemplate, etc.) should support taking arguments in this format, or a similar one that accomplishes the same thing.