Module talk:Lua call/testcases



{{#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()

{{#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-0000000F-QINU`"', '"`UNIQ--ref-00000010-QINU`"', '"`UNIQ--nowiki-00000011-QINU`"', <code>c</code>, '"`UNIQ--pre-00000012-QINU`"', '"`UNIQ--ref-00000013-QINU`"', '"`UNIQ--nowiki-00000014-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

, [5], n, c,

p2

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

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

nowiki

{{#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

, [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: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

, [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

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

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.