Hello!
On Tue, Mar 5, 2013 at 6:27 AM, Ron Gomes wrote:
> Got it, thanks. I rewrote to eliminate the use of module(...), instead
> using the "local M={}" style, as in fact I had been doing before seeing
> examples in Lua documentation that seemed to suggest that module() was
> preferable.
>
> That cleaned up the namespace considerably and made all the "local pairs =
> pairs" (etc.) definitions unnecessary.
>
Just ensure that you properly check attempts of writing to undeclared
Lua variables, which could lead to unexpected data sharing across the
concurrent requests, which is dangerous (consider that user A may see
user B's data occasionally) and hard to debug. See
http://wiki.nginx.org/HttpLuaModule#Lua_Variable_Scope
Also, because the environment table (and thus globals) of each request
is transient, ensure that you always local-ize variables (or
functions) that you actually use in your module.
Personally I've found the "module(...)" notation handy and I've been
using it in all of my lua-resty-* libraries :) But package.seeall is
really bad and should always be avoided.
Best regards,
-agentzh