Hacker News new | ask | show | jobs
by zeen 5279 days ago
You got it. Quoting from the 5.2 manual:

  Because of the lexical scoping rules, local variables can
  be freely accessed by functions defined inside their scope.
  A local variable used by an inner function is called an
  upvalue, or external local variable, inside the inner
  function.
i.e., the external local variables the closure is closed on. And for C functions made available to Lua scripts:

  When a C function is created, it is possible to associate
  some values with it, thus creating a C closure (see
  lua_pushcclosure); these values are called upvalues and are
  accessible to the function whenever it is called.
- http://www.lua.org/manual/5.2/manual.html