Self Debugging
A short guide on how you can debug code yourself in order to provide more detailed information to the codesign support team.


What is self debugging?

LUA Debugging

Basic LUA Debugging Example

This is a basic example of how to debug LUA code.
Option 1: You can prints the variables being received/sent in events/functions (or just any variables in general). But you will not be able to print booleans unless you convert them into strings.
Option 2: You can also use prints to debug what may be causing a script to error or what may be causing the code to not reach a certain line. We can do this by adding a print on every line in a certain part of the code which is having issues (just change the string in the print so its unique eg., "here 1", "here 2"), and you will be able to see which line the code is not able to get passed, then you will know what line of code is causing the problem.
Option 3: In most cases these are both best used together to actually see what's going on in the code.

LUA Table Debugging

If you try to print a table using the methods above, it will normally look like this - table: 0xe2a670.
So in order to see the data inside tables we need to use another method, luckily we released a free resource which does just this!
This is a preview from cd_devtools.

Useful Tip for LUA Debugging

What this does it display all of the prints on your screen instead of only displaying in the client-side F8 console, its just a small quality of life feature for developers.
This is an example of this in use.
How to enable
How to disable
Type this in your client-side F8 console:
con_miniconChannels script:*
Type this in your client-side F8 console:
con_miniconChannels 0


Do you still need more help with prints?

SQL Debugging

This is an example of SQL debug prints in the server console.
This will print all SQL queries into your sever console so you can see what's going on database wise.
How to enable
Add any of these lines anywhere in your server.cfg.
set mysql_debug "Console"
set mysql_debug