lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


KHMan wrote:
Bertrand Mansion wrote:
Is there a lua snippet that can "beautify" lua source code, especially
indentation?
This one <http://lua-users.org/wiki/SciteIndentation> doesn't work well,
it's missing a lot of things code snippets within multiline comments for
example.
Others might have better ideas or suggestions than the above,
which is highly speculative.

One thing you might look at is Firefox's Javascript engine. In Javascript, calling toString() on a function object returns a prettified version of the function's code. For an example, paste this (all one line) into the Firefox Error Console (Tools -> Error Console):

(function () { var i=0; for(i=0;i<10;i++) doSomething(); doSomethingElse(); }).toString()

I'm not familiar with the internals of Firefox's Javascript implementation, but this may be helpful in some roundabout way. :)

- Jim