Module talk:LuaCall/testcases

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia



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

test test test test test test test 

{{#invoke:LuaCall|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:LuaCall|main|pattern=(%a)|replace=%1.|string=I can't get no satisfaction|mw.ustring.gsub(string,pattern,replace)|reserved_return=2}}

22

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

2

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

1

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

0.4512

{{#invoke:LuaCall|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:LuaCall|main|value=abcd|start=2|end=3|string.sub(value,start,end)}}

bc


call()[edit]

{{#invoke:LuaCall|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:LuaCall|call|mw.log|#invoke}}, {{Ping|Ans}}, [[User:Ans]]}}

will display


'"`UNIQ--pre-0000008A-QINU`"', '"`UNIQ--ref-0000008B-QINU`"', '"`UNIQ--nowiki-0000008C-QINU`"', <code>c</code>, '"`UNIQ--pre-0000008D-QINU`"', '"`UNIQ--ref-0000008E-QINU`"', '"`UNIQ--nowiki-0000008F-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:LuaCall|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:LuaCall|call|mw.log|#invoke}}, {{Ping|Ans}}, [[User:Ans]]}}

will display

p

, [5], n, c,

p2

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

--Ans (talk) 05:50, 15 March 2019 (UTC)[reply]

nowiki[edit]

{{#invoke:LuaCall|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:LuaCall|call|mw.log|#invoke}}, {{Ping|Ans}}, [[User:Ans]]

, LuaCall/testcases, &&,

p

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

p2

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



{{#invoke:LuaCall|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:LuaCall|call|mw.log|#invoke}}, {{Ping|Ans}}, User:Ans

, LuaCall/testcases, &&,

p

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

p2

, [12], 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
  5. ^ r
  6. ^ r2
  7. ^ r
  8. ^ r2
  9. ^ r
  10. ^ r2
  11. ^ r
  12. ^ r2
  13. ^ pass <ref> to mw.log