Hi,
My Lua functions often exceed 500 lines and I then need to refactor blocks in if statements and loops to a separate function. I use MSVC a bit and it has a plugin called Visual Assist which can convert a given chunk of C/C++ code into a function with the proper required arguments. Its very useful in a hurry :)
Has anyone tried something similar for Lua? Basically I would want to give it a block of code and it would need to deduce the required arguments for the function and give me back the code string as "function (args...) ... end".
I am going to try it today with regexes and maybe ltokenp, but wanted to check if someone has already tried it.
A simple converter could perhaps detect patterns like "<0 or more spaces><1 or more valid variable name chars><Lua delimiter like '(' or ',' >" and then put the variable names into the argument list if they are not present in _G. Reserved words skipped.
Not sure of the relevant part in lexer.c yet, that I could perhaps convert to do this.
Thanks,
Abhi