How to debug locally

Debugging locally means that you run the debug console in the same page in which the VM is running. This is simple; all you need to do is add a couple of JavaScript files to your page.

To do this, download the full Moonshine project and copy the debug extension folder into your project's file path. You can then add the two highlighted lines of code below, which will add the debug engine and the local debug UI to your page. Remember to include the data-ui-url; the script will need this to know where to find the html files for the UI in your setup.

Make sure you add the lines after you include the Moonshine VM and before you load any Lua scripts, as shown.

<script src="/js/moonshine/moonshine.min.js"></script>
<script src="/js/moonshine/extensions/debug/debug.moonshine.js"></script>
<script src="/js/moonshine/extensions/debug/local.debug.moonshine.js" data-ui-url="/js/moonshine/extensions/debug/ui"></script>
	var vm = new shine.VM();