Does it work?
I think Lr2 is "strict" by default, Lr3 is not. - I've had plugins that work in Lr3 crash in Lr2 due to accessing unitinialized global variables.
I would definitely prefer 'strict' for any Lr3 plugins that need to maintain compatibility with Lr2 as well...
In fact, although I've taken advantage of "non-strictness" in Lr3, I don't think I would consider it a "best practice" in most situations - kinda like using the same variable for a table, then an unrelated string, then a random number... - you can, but that doesn't mean you should...
While I'm at it, declaring an SDK version 2.0 does not necessarily mean you'll get an error in Lr3 when doing things in Lr3 that are not supported in Lr2 - this is an example.
So far, it seems to work very well. I just copied "strict.lua" from the Lua distribution and do
and it catches most of my mistakes. (It doesn't catch the times I make a function global rather than local.)
Maybe a variation of dump(object), say dumpFunctions(object), then
dumpFunctions( _G ) to catch your global functions.
Yeah, I started doing that, but now I've gone off the deep end and written a mini-debugger that does all sorts of stuff as well as your suggestion. After I use it for a few for days, I'll make it available for others to try. It's limited in key ways due to Lightroom crippling the "debug." functions, but I am still able to have it do a fair amount (breakpoints on functions, stack trace, interactive read-eval-print).
John - You never cease to amaze me!