Module:Electowidget/doc: Difference between revisions

From electowiki
Content added Content deleted
(Adding prefs_line_json in the name of doing test-driven development)
(Added parameter to #Test 3)
Line 24: Line 24:
=== Test 3 ===
=== Test 3 ===
<blockquote><nowiki>
<blockquote><nowiki>
{{#invoke:Electowidget|get_data}}
{{#invoke:Electowidget|get_data|"2009 Burlington, Vermont Mayoral Election data"}}
</nowiki></blockquote>
</nowiki></blockquote>


=== Result 3 ===
=== Result 3 ===
{{#invoke:Electowidget|get_data}}
{{#invoke:Electowidget|get_data|"2009 Burlington, Vermont Mayoral Election data"}}

Revision as of 04:13, 7 September 2023

This is the very beginning of a Lua implementation of Electowidget.

Tests

Test 1

{{#invoke:Electowidget|parse_prefs_line|24: "蘇業"/5 > DGM/2 = AM/2 > SBJ/}}

Result 1

table

Test 2

{{#invoke:Electowidget|prefs_line_json|24: "蘇業"/5 > DGM/2 = AM/2 > SBJ/}}

Result 2

{"prefs":[{"name":"foo1","rating":1},{"name":"foo2","rating":2}],"qty":9999,"orderedlist":true}

Test 3

{{#invoke:Electowidget|get_data|"2009 Burlington, Vermont Mayoral Election data"}}

Result 3

Lua error in Module:Electowidget at line 48: attempt to index local 's' (a nil value).