Debug
This dialog is invoked by calling debug.debug () from within a Lua script.
You can use it to inspect variables, do a traceback, enter debugging commands, or abort the script.
Source
The short form of the source of this script. If loaded from a file it will be the filename preceded by the "@" symbol.
First, last lines
If known, the first and last line numbers in which the current function was defined.
Current line
The line number inside the script at which the debug.debug () command resides.
What function is
This will be one of:
If it can be determined, the name of the current function, followed by what the name is in brackets. (eg. "myfunction (local)" ).
Function
The function address.
Number of upvalues
How many upvalues this function has.
Show upvalues
Clicking this runs a small script to display the upvalues of the current function, if any, in the output window. The script looks like this:
Clicking this runs a small script to display the local variables of the current function, if any, in the output window. The script looks like this:
Clicking this runs a small script do display the traceback information, namely:
You can type Lua commands into this window and press <Enter> (or click on Do Command). The command you entered is sent to the Lua interpreter to be executed in the context of the current script. For example, you could print or change global variables. The current command is remembered from one debug session to the next.
Edit...
Click this to edit the current contents of the command window in a larger dialog box. This larger box has access to function help, and function-name completion.
Do command
Sends the contents of the "command" box to the Lua interpreter.
Continue execution
Lets the script that called debug.debug () continue executing. Pressing <Esc> to dismiss the dialog has the same effect.
Abort script
Aborts the calling script with the error "Script aborted".
You can use it to inspect variables, do a traceback, enter debugging commands, or abort the script.
Source
The short form of the source of this script. If loaded from a file it will be the filename preceded by the "@" symbol.
First, last lines
If known, the first and last line numbers in which the current function was defined.
Current line
The line number inside the script at which the debug.debug () command resides.
What function is
This will be one of:
-
Lua - a regular Lua function
main - inside the main Lua chunk (that is, not inside a function)
C - a C function
If it can be determined, the name of the current function, followed by what the name is in brackets. (eg. "myfunction (local)" ).
Function
The function address.
Number of upvalues
How many upvalues this function has.
Show upvalues
Clicking this runs a small script to display the upvalues of the current function, if any, in the output window. The script looks like this:
do
local i, name, val = 1
local t = debug.getinfo (3, 'f')
local f = t.func
-- keep going until we run out of values
repeat
name, val = debug.getupvalue (f, i)
if name then
ColourNote ('limegreen', 'black', name .. ' = ' .. tostring (val))
i = i + 1
end
until not name
ColourNote ('limegreen', 'black', tostring (i - 1) .. ' upvalue(s)')
end -- of local block
Show localsClicking this runs a small script to display the local variables of the current function, if any, in the output window. The script looks like this:
do local i, name, val = 1
repeat
name, val = debug.getlocal (3, i)
if name then
ColourNote ('limegreen', 'black', name .. ' = ' .. tostring (val))
i = i + 1
end
until not name
ColourNote ('limegreen', 'black', tostring (i - 1) .. ' local(s)')
end -- local block
TracebackClicking this runs a small script do display the traceback information, namely:
ColourNote ('limegreen', 'black', debug.traceback ())
CommandYou can type Lua commands into this window and press <Enter> (or click on Do Command). The command you entered is sent to the Lua interpreter to be executed in the context of the current script. For example, you could print or change global variables. The current command is remembered from one debug session to the next.
Edit...
Click this to edit the current contents of the command window in a larger dialog box. This larger box has access to function help, and function-name completion.
Do command
Sends the contents of the "command" box to the Lua interpreter.
Continue execution
Lets the script that called debug.debug () continue executing. Pressing <Esc> to dismiss the dialog has the same effect.
Abort script
Aborts the calling script with the error "Script aborted".
Topics
- Arrays
- Database (SQLite)
- Lua LPEG library
- Lua PCRE regular expression functions
- Lua SQLite (database) interface
- Lua base functions
- Lua bc (big number) functions
- Lua bit manipulation functions
- Lua coroutine functions
- Lua debug functions
- Lua io functions
- Lua math functions
- Lua os functions
- Lua package functions
- Lua script extensions
- Lua string functions
- Lua syntax
- Lua table functions
- Lua utilities
- Plugins
- Scripting callbacks - MXP
- Scripting callbacks - plugins
- Scripting data types
- Scripting functions list
- Scripting return codes
- Scripting
- Utilities
- Variables
- World functions