Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

Jump to content

Module talk:Lua call/testcases

Page contents not supported in other languages.
Add topic
From Wikipedia, the free encyclopedia
Latest comment: 7 years ago by Ans in topic call()

{{#invoke:Lua call|main|a=test |b=7|string.rep(a,b)}}

test test test test test test test 

{{#invoke:Lua call|main|pattern=(%a)|replace=%1.|string=I can't get no satisfaction|mw.ustring.gsub(string,pattern,replace)|reserved_return=1}}

I. c.a.n.'t. g.e.t. n.o. s.a.t.i.s.f.a.c.t.i.o.n.

{{#invoke:Lua call|main|pattern=(%a)|replace=%1.|string=I can't get no satisfaction|mw.ustring.gsub(string,pattern,replace)|reserved_return=2}}

22

{{#invoke:Lua call|main|value=1.4512|math.ceil(value)}}

2

{{#invoke:Lua call|main|value=1.4512|math.modf(value)}}

1

{{#invoke:Lua call|main|value=1.4512|math.modf(value)|reserved_return=2}}

0.4512

{{#invoke:Lua call|main|value=... that the '''[[Privacy and Civil Liberties Oversight Board report on mass surveillance]]''' recommended against imposing a [[data retention]] requirement on U.S. phone companies?|string.len(value)}}

181

For comparison with n:Template:Evalx:

{{#invoke:Lua call|main|value=abcd|start=2|end=3|string.sub(value,start,end)}}

bc


call()

[edit]

{{#invoke:Lua call|call|mw.log|<pre>p</pre>, <ref>r</ref>, <nowiki>n</nowiki>, <code>c</code>, {{#tag:pre|p2}}, {{#tag:ref|r2}}, {{#tag:nowiki|n2}}, {{#tag:code|c2}}, {{#invoke:Lua call|call|mw.log|#invoke}}, {{Ping|Ans}}, [[User:Ans]]}}

will display

'"`UNIQ--pre-00000006-QINU`"', '"`UNIQ--ref-00000007-QINU`"', '"`UNIQ--nowiki-00000008-QINU`"', <code>c</code>, '"`UNIQ--pre-00000009-QINU`"', '"`UNIQ--ref-0000000A-QINU`"', '"`UNIQ--nowiki-0000000B-QINU`"', <code>c2</code>, , <span class="template-ping">@[[User:Ans|Ans]]:</span>, [[User:Ans]]

in Lua logs. --Ans (talk) 05:29, 15 March 2019 (UTC)Reply

{{#invoke:Lua call|call|mw.ustring.sub|<pre>p</pre>, <ref>r</ref>, <nowiki>n</nowiki>, <code>c</code>, {{#tag:pre|p2}}, {{#tag:ref|r2}}, {{#tag:nowiki|n2}}, {{#tag:code|c2}}, {{#invoke:Lua call|call|mw.log|#invoke}}, {{Ping|Ans}}, [[User:Ans]]}}

will display

p

, [1], n, c,

p2

, [2], n2, c2, , @Ans:, User:Ans

--Ans (talk) 05:50, 15 March 2019 (UTC)Reply

nowiki

[edit]

{{#invoke:Lua call|call|mw.log|nowiki1}}, {{PAGENAME}}, &&, <pre>p</pre>, <ref>r</ref>, <nowiki>n</nowiki>, <code>c</code>, {{#tag:pre|p2}}, {{#tag:ref|r2}}, {{#tag:nowiki|n2}}, {{#tag:code|c2}}, {{#invoke:Lua call|call|mw.log|#invoke}}, {{Ping|Ans}}, [[User:Ans]]

, Lua call/testcases, &&, '"`UNIQ--pre-00000012-QINU`"', '"`UNIQ--ref-00000013-QINU`"', '"`UNIQ--nowiki-00000014-QINU`"', <nowiki>n2</nowiki>, <code>c</code>, '"`UNIQ--pre-00000015-QINU`"', '"`UNIQ--ref-00000016-QINU`"', '"`UNIQ--nowiki-00000017-QINU`"', <code>c2</code>, , <span class="template-ping">@[[User:Ans|Ans]]:</span>, [[User:Ans]]

{{#invoke:Lua call|call|mw.log|nowiki1}}, {{PAGENAME}}, &&, <pre>p</pre>, <ref>r</ref>, <nowiki>n</nowiki>, <code>c</code>, {{#tag:pre|p2}}, {{#tag:ref|r2}}, {{#tag:nowiki|n2}}, {{#tag:code|c2}}, {{#invoke:Lua call|call|mw.log|#invoke}}, {{Ping|Ans}}, User:Ans

, Lua call/testcases, &&,

p

, [3], n[[User:Ans]], <nowiki>n2</nowiki>, <code>c</code>,

p2

, [4], n2, <code>c2</code>, , <span class="template-ping">@Ans:</span>, User:Ans

passing parameter

[edit]

2{{}}x2{{}}x

yes

3

3

yesyesyes

1

[yes yes]. {{cite web}}: Check |url= value (help); Missing or empty |title= (help); Text "yes" ignored (help); Text "yes" ignored (help); Text "yes" ignored (help); Text "yes" ignored (help); Text "yes" ignored (help); Text "yes" ignored (help)

table

{{{1}}}{{{1}}}

Script error: The function "wrap2" does not exist.

  1. r
  2. r2
  3. r
  4. r2