How to debug plugin variables

Posted by Nick Gammon on Tue 15 Aug 2006 10:36 PM — 1 posts, 5,906 views.

Australia Forum Administrator #0
I recently had occasion to try to debug a plugin, and wanted to know what the variables contained (the Lua variables, not the MUSHclient variables).

If you simply try to do something like this, it doesn't work because it shows the variable from the main script space, not the plugin script space:


/Note (myvariable)


This simple alias below solves this by being installed in the plugin, and then it displays the plugin variable (or does any script command, like setting a variable):


<aliases>
  <alias
   match="~*"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>assert (loadstring (FixupEscapeSequences[[%1]])) ()</send>
  </alias>
</aliases>


This is the Lua version, although VBscript has something similar (the Execute function).

Now all I have to do is put "~" in front of my script command, like this:


~Note (myvariable) --> inspect variable
~myvariable = 42 --> change variable


Of course, you remove the alias when you have finished debugging.