lua-users home
lua-l archive

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

On 04/17/2013 02:36 AM, Hisham wrote:
I beg to differ. Most of my mistakes involving globals is due to
mistyping a variable and happily using it (which then equals nil).
Well you right, this is a very common mistake, but at least, in most cases you will find out this error as soon as you access this nil value. If you using globals LHS by mistake you often don't even have an error until you do the same mistake in another script and then access the same variable. Well what are the chances to make the same mistake twice? Pretty high if you use copy and paste.
Integrating the wonderful metalua-based lua-inspect tool into my text
editor has done wonders to deal with this (thank you Fabien and
David!). Now those undeclared globals show up in bright yellow with a
red background, which makes them really hard to miss. :)
I want to do the same, but I didn't have time till now. We use Eclipse and EMF Text, and I first have to teach my editor about Lua scoping (which I want to do anyway) and than I can do this. Yellow on red, isn't that a bit too heavy? ;)

-- Hisham