Building a Standard Interface Template

Leverage Annotations Effectively

Programming with annotations is a new kind of programming. Once you start to get familiar with it you’ll find there are powerful ways you can leverage them.

A couple of tricks that I find useful.

One is make a dummy function like:

local function trace(a,b,c,d) return end

Then I can call it and it’s just like a print statement but it doesn’t output data into the logs. Another good technique to give visibility to things like why a message is being filtered is to make a function like:

function ReportFilter(Reason)
   print("Message filtered:\n"..Reason)

near the top of the file. Then when a message is filtered I invoke that function with the reason why so that it appears near the top of the file. This is just one of the little tricks where one can kind of create your own adhoc GUIs using annotations.

Other good techniques are to use helper functions inside loops rather than writing the logic inline inside the loop. This will give you much more readable annotations.

Leave A Comment?

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.