Skip to main content

Auto-Indentation

Indentation helps make code easier to read and understand. Indentation helps to visually separate different Block statements to show their hierarchical relationship. You can especially appreciate this when working with a for loop and if statements.

Select a block and click tab. This is very helpful trick in translator to get all the block commands aligned in the editor.

Start with some code which isn't well aligned in the translator

function main(Data)   
for i=1, 1000 do
if i == 500 then
trace(i)
end
end
end

Select the whole block, and then press tab

Before:

Tada! The editor will align all the blocks

And after:

This is a very helpful technique for making your code easier to read and understand.