Before 5.6 - roll your own trace()
Before Iguana 5.6 it was necessary to create your own trace function, this page describes how it worked.
How does this work?
As you can see tracing the variable “s” shows its value in the annotation block:
Iguana displays the parameters of all function calls in the annotation block.
- The parameters for
trace()are displayed like any other function.
trace()function does nothing, it is only used to display parameters.
Examples of using trace()
Here are some questions that come up when using our “old style” trace()
- Our company already has a
trace()function, can I use a different name?
- Why is
trace()at the top of the file, can I put it at the end?
- Why is there a return in the
trace()code, can it be removed?
Our company already has a trace()
function, can I use a different name?
Yes it is only a function so any name can be used. We recommend that our customers keep the same name if possible, as we use it as a standard all our wiki code.
But as you can see another name will work fine:
Why is trace()
at the top of the file, can I put it at the end?
The easiest thing is to try it:
As you can see it does not work. In Lua local functions must be declared before they are called.
You could change it to a global function:
If you declare trace() globally it will be visible in all modules. We prefer to declare it as local and add it to modules when we need it.
Why is there a return in the trace() code, can it be removed?
No it cannot be removed because
trace() will not display nil values correctly.
Technically it can be removed, but as you can see the result gets confusing: