Muris wrote:I honestly think the worst thing about LUA is the fact that instead of crashing, it actually makes global variables by default unless especially told not to aka local. [...] I have a gut feeling that if the project size grows, the probability of me not being able to track bugs that comes from having accidentally created globals, and not being able to find a bug in my program.
Lafolie wrote: From what I've read there is actually little impact using globals over locals[...] They're mostly recommended because it helps to 'keep the scope clean' and makes your code somewhat easier to maintain
@Muris: I strongly suspect that Lafolie is referring to locals in that last phrase("locals are recommended because they keep the scope clean), but he ended up saying the opposite of what he meant.
The reason why I decided to go with libgdx on my project is mostly because I have a gut feeling that if the project size grows, the probability of me not being able to track bugs that comes from having accidentally created globals, and not being able to find a bug in my program.
I have used luacheck to detect unused/global variables in my code with good success recently. It does static analysis of your code, so it can warn you about these issues before run-time.
jjmafiae wrote:
tip 4: use locals and remove any unused globals
makes your code somewhat easier to maintain.
Globals and easier to maintain code doesn't really sound like something I would put together in most cases, unless you are 100% sure that you know exactly what you are doing. I honestly think the worst thing about LUA is the fact that instead of crashing, it actually makes global variables by default unless especially told not to aka local.
The reason why I decided to go with libgdx on my project is mostly because I have a gut feeling that if the project size grows, the probability of me not being able to track bugs that comes from having accidentally created globals, and not being able to find a bug in my program. The other reason is that I feel that debugging in java is easier, but there could be good tools for lua too.
Still I honestly think that Love2D is probably the best 2d engine I have seen so far, and most productive thing I've found.
You should try zerobrane studio, it has full in-code stepping, breakpoints, a REPL and can do livecoding!