User:Planotse/Sandbox/Test1

function outputTable( columns, table ) { append "{| class='wikitable'\n"; for( name : title in columns ) { append "! " + title + "\n"; }

for( row in table ) { append "|-\n"; for( name : title in columns ) { append "| " + row[name] + "\n"; } }

append "|}\n"; }

function getHeaders { return { "a" : "A's", "b" : "B's", "c" : "C's" }; }

function getTable { yield { "c" : 42, "b" : 22, "a" : 33 }; yield { "c" : 10, "b" : 21, "a" : 31 }; yield { "a" : "abc", "b" : "def", "c" : "ghi" }; yield { "b" : "Hello, world!", "a" : "Lol wut?", "c" : "Testing 12345" }; }

function main( a, b, c ) { return self::outputTable(   self::getHeaders,    self::getTable + { "a" : a, "b" : b, "c" : c }; }