Skip to content

sigsci-module-nginx Lua

Nginx Lua Module for Signal Sciences NGWAF

Development Environment and Procedures

See DEVELOPMENT.md

Release Package Procedures

See RELEASE.md

Troubleshooting Tips and FAQs

See TROUBLESHOOTING.md

WARNING

Like javascript, all variables in Lua are in the global scope. Prefix variables using local to declare local scope. (similar to how javascript works with var).

But unlike javascript, there is only one lua interpreter for all requests. So things in global scope are shared between requests. This would be equivalent to setting javascript variables on one browser page, and another page could read them. This is very bad. Almost always, use local scope. We have static analysis checks to fix this.

Also unlike javascript where its Global or Local, Lua also scopes into blocks (like C or Python), and allows shadow variables.


x = 200
function foo()
   print x -- 200
   local x = 100
   for i = 1..3 do
      local x = i
      print x -- 1,2,3
  end
    print x  -- 100
end