SerpentofSetGive feedback
Joined 26 September 2024
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
| Latest revision | Your text | ||
| Line 1: | Line 1: | ||
I am bad at the game so I edit the wiki | |||
Below stolen shamelessly from the MediaWiki Scribunto articles | |||
== | ==Examples== | ||
===Invoking module directly=== | |||
Given [[Module:Test]] with the following contents: | |||
<syntaxhighlight lang="lua"> | |||
local p = {} | |||
function p.main(frame) | |||
local args = frame.args | |||
mw.log("log test") | |||
return args[1]..args["sep"]..args[2] | |||
end | |||
return p | |||
</syntaxhighlight> | |||
The following invoke call: | |||
<code><nowiki>{{#invoke:Test|a|sep=;|b}}</nowiki></code> | <code><nowiki>{{#invoke:Test|a|sep=;|b}}</nowiki></code> | ||
Can be simulated accurately with the following code in the debug console: | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
=p.main( | =p.main( | ||
| Line 11: | Line 25: | ||
} | } | ||
)</syntaxhighlight> | )</syntaxhighlight> | ||
===Simplified version=== | Note that in this example the element in the export table which is being evaluated is called "main". | ||
====Simplified version==== | |||
If the module you are debugging does not use any [[Extension:Scribunto/Lua_reference_manual#Frame_object|frame object methods]] (such as <code>frame:preprocess()</code>), like the example [[#Invoking module directly|above]], then the frame object analog(?) does not have to be complete, and the debugging code can be simplified into the following: | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
=p.main{ | =p.main{ | ||
| Line 17: | Line 34: | ||
}</syntaxhighlight> | }</syntaxhighlight> | ||
What's a sandbox | |||
= | {{PageRef|Yamato|type=Hero}} | ||
{{#invoke:HeroDataArrays|heroHealthTable}} | |||
[[File:Siphon Life.png|class=abilityicon]] | [[File:Siphon Life.png|class=abilityicon]] | ||
[[File:Tornado.png|class=abilityicon]] | [[File:Tornado.png|class=abilityicon]] | ||
{{#invoke:ItemsByStat|tablefy|BulletLifestealPercent|+X% Bullet Lifesteal|%}} | |||
Use this for the debug console when testing the ItemsByStat page: =p.tablefy( mw.getCurrentFrame():newChild{ | |||
title="Module:ItemsByStat", args={"BulletLifestealPercent", "+X% Bullet Lifesteal", "%"} }) | |||