lua-users home
lua-l archive

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


Enforce strict declaration of all variables (including functions) in any environment prior to any use or reassignment within that environment.

I am happy to announce release 1.0 of strict.

This module started life as `etc/strict.lua` in the Lua 5.0 distribution, and has shipped for several years in lua-stdlib.  I’m in the process of slimming down lua-stdlib in preparation for the next release though, part of which means that you can now use strict without requiring the installation of all of stdlib.


## Noteworthy changes in release 1.0 (2016-01-19) [stable]

### New features

  - Initial release, now separated out from lua-stdlib.

### Incompatible changes (compared to stdlib-41.2.0)

  - The standalone implementation no longer requires or is affected by the value of `std.debug_init._DEBUG.strict`.  If you still want to  do that you can write:

    local strict = require "strict"
    local _DEBUG = require "std.debug_init"._DEBUG

    local _ENV = _ENV
    if nil ~= (_DEBUG or {}).strict then
      _ENV = strict.strict (_ENV)
    end
    if rawget (_G, "setfenv") ~= nil then
      setfenv (1, _ENV)
    end


Install it with LuaRocks using:

    luarocks install strict 1.0