Help:Lua debugging: Difference between revisions

Content deleted Content added
Line 33:
To obtain variables and values returned from functions (not local in both cases) the "Debug console" can be used. The "Debug console" appears below in the module page (when it is in edit mode). Then <code>mw.log</code> and <code>mw.logObject</code> will be used. Let's see its usefulness in the next example (module that can be found [[Module:Example of lua debugging|here]]):
 
{{Module:Example of lua debugging}}
<syntaxhighlight lang="Lua">
local p = {}
p.Hello = 'Hello'
function p.calc(num)
return num
end
function p.sum_mult(num)
return num + num, num * num
end
function p.mtable(num)
return {num, num+1}
end
return p
</syntaxhighlight>
 
Requests to "Debug Console":