Bitfighter
021
The Bitfighter Lua Documentation - Robots, Levelgens, and Plugins
|
Any of your scripts can print a stack trace with the _stackTracer() command (see sample usage below). This will show how you got to a particular execution point, and will print the values of various variables and other potentially useful information. This can be very helpful if there are several conditions under which a function can be called, or why something went wrong.
The print(msg) command will print a message the in-game console (which you can turn on with ctrl+/), and logprint(msg) will print a message to the console, the terminal, and the Bitfighter logfile.
Lua's error command will stop the script, print a message, and cause a stack trace to be printed. Use assert to confirm that a condition is true.
Finally, if you detect an unexpected error condition, you can log a message, trigger a stack trace, and terminate the script with Lua's error function.
Other tricks:
There are a couple of other ways to get info out of a script. None of these are appropriate for long term usage, but they do work well for quick and dirty debugging.
Bots can print short messages to the global chat like so:
Levelgens can do this as well, or print short messages by setting the announcement message: