Scripting Best Practices

Indentation

It goes without saying that proper indentation is critical for proper readability. Good indentation breaks up heavy blocks of code into logical groups and obvious relationships that are easy to scan and even easier to understand.

Use Auto-indentation

Did you know that Iguana comes equipped with an auto-indentation feature? Simply select a block of code and press Tab, and Iguana will intuitively apply the correct indentation structure for you. We strongly recommend that you use this feature as part of your regular coding practice.

Include Additional Comments

Indents are particularly useful when writing loop/block structures, but what if you are working with a particularly complex logic path? By adding a brief “end” comment to all the ‘end’s in a loop, you provide valuable visual cues that can boost indentation’s benefits:

   if isValid then 
      for i=1, 100 do
         for k,v in ipairs(custTable) do

            -- code goes here!

         end -- for k,v in ipairs(custTable)
      end -- for i=1, 100 
   end -- if isValid
Tagged:

Leave A Comment?

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