Jump to content

Module talk:Lua call/testcases

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Pppery (talk | contribs) at 02:11, 17 March 2019 (Moving talk to talk page). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

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

{{#invoke:LuaCall|call|mw.log|<pre>p</pre>, <ref>r</ref>, <nowiki>n</nowiki>, <code>c</code>, {{Ping|Ans}}, [[User:Ans]]}}

will display


'"`UNIQ--pre-0000000C-QINU`"', '"`UNIQ--ref-0000000D-QINU`"', '"`UNIQ--nowiki-0000000E-QINU`"', <code>c</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>, {{Ping|Ans}}, [[User:Ans]]}}

will display

p

, [3], n, c, @Ans:, User:Ans

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

  1. ^ r
  2. ^ r
  3. ^ r