Help:Lua debugging: Difference between revisions

Content deleted Content added
m top: rm apostrophe
new key for Category:Module help: "Debugging" using HotCat
 
(4 intermediate revisions by 2 users not shown)
Line 40:
! Request !! Returned value
|-
| {{colorcode|blue2=lua|mw.log(p.Hello)}}|| {{samp|"Hello"}}
|-
| {{colorcode|blue2=lua|mw.log(p.calc(10/2))}} || {{samp|5}}
|-
| {{colorcode|blue2=lua|mw.log(p.sum_mult(3))}} || {{samp|6   9}}
|-
| {{colorcode|blue2=lua|mw.log(p.mtable(4))}} || {{samp|table}}
|-
| {{colorcode|blue2=lua|mw.logObject(p.mtable(4))}} || {{sxhl|2=lua|
table#1 {
:4,
:5,
}
}}
|-
| {{bluecode|2=lua|{{=}}p.sum_mult(10)}} || {{samp|20 100}}
|-
| {{bluecode|2=lua|{{=}}p.Hello .. ', World!'}} || {{samp|Hello, World!}}
|}
 
Line 84 ⟶ 85:
 
=== Small caveat: The case of the wrong case ===
Wikipedia has a small perversion regarding page name casing: it will convert the first character of a page name to uppercase, regardless of the way it was entered. To compensate, it also converts the first letter of a template (when transcluded) and module (when invoked) to uppercase. however, this does not extend to the modules stored in User: namespace viewed through the special [[Template sandbox]], because in the sandbox "the first letter" is not the first letter any more. Here is an actual example: for real modules, let's say [[Module:String]], mediawiki software will allow you to use <nowiki>{{#invoke:mlx|String|replace|Hara I am|a|e}}</nowiki> to return "Here I em" (try it). It will also allow you to use <nowiki>{{#invoke:mlx|string|replace|Hara I am|a|e}}</nowiki> to get the same result:
{|class="wikitable"
|-
! wikitext !! result
|-
|<nowiki>{{#invoke:mlx|String | replace | Hara I am |a|e}}</nowiki>||{{#invoke:String | replace | Hara I am |a|e}}
|-
|<nowiki>{{#invoke:mlx|string | replace | Hara I am |a|e}}</nowiki>||{{#invoke:string | replace | Hara I am |a|e}}
|}
 
Line 133 ⟶ 134:
[[Category:Wikipedia how-to]]
[[Category:Wikipedia text help]]
[[Category:WikipediaModule moduleshelp|Debugging]]