Module:SimpleDebug/doc

Contains a functions to help debug the lua modules. It allows to collect and view the values of several variables and/or points in your lua program, from a module (which is usual) or in several modules (which are required from the main module).

It is designed so that its functions are called from within the module that is to be debugged, calls that will have to be part of the code (of the module that you have designed, or that you want to improve or adapt) until you decide to delete them (when you already have determined the bug). Thus, you do not have to call any of its functions from an invoke.

Following the flow
returns:

Here is reached

Number of decimal places and value of a variable
returns:

0.33

Nohtml
returns:

"⪡b⪢bold⪡/b⪢"

Plaintext
returns:

"bold"

The value of several variables
returns:

12  •  "Hello"

Non-assigned variable detection
returns:

true  •  nil

The value of a table
returns: { 1, "b", [tab]="a", }

returns:

{  [1] = {1, 2, 3, },   [2] = {4, 5, 6, },   [3] = {7, 8, 9, }, }

returns:

{  [1] = {2, 3, [First]=1, }, [2] = {4, 6, [Second]=5, }, [3] = {7, 8, 9, }, }

returns:

{   [1]={[1]=1, [2]=2, [3]=3, },    [2]={[1]=4, [3]=6, },    [3]={[1]=7, [2]=8, [3]=9, },  }

Usually, you implement these functions with error function: displays:

{{color|red|Lua error:Module:YourModule:Line:{}}  [1] = {1, 2, 3, },   [2] = {4, 5, 6, },    [3] = {7, 8, 9, },  } 

All values of a table in multiline
retorna:

{ [1] = {    [1] = 2,     [2] = 3,     ["First"] = 1, }, [2] = "Middle", [3] = {    [1] = 4,     [2] = 6,     ["Second"] = 5, }, }

The value of several variables with their name in a point
returns:

a: 12  •  b: "Hello"

Following the flow
returns:

Lua Error:Module:Your module:Line:

little number

little number.

With counter
returns:

1  •  2

2  •  4

3  •  6

Monitoring of several variables
returns:

1 => 12  •  "Hello"

Finally => 24  •  "Hello world!"

displays:

Lua error:Module:YourModule:Line:

Variables and their presentation with conditions
displays:

Lua error:Module:YourModule:Line: