All Projects → lua-stdlib → strict

lua-stdlib / strict

Licence: MIT license
Check for use of undeclared variables

Programming Languages

lua
6591 projects
Makefile
30231 projects

Projects that are alternatives of or similar to strict

ljdns
A contemporary DNS library using LuaJIT FFI.
Stars: ✭ 26 (-18.75%)
Mutual labels:  luajit, luarocks
lcurses
Lua bindings for Curses
Stars: ✭ 60 (+87.5%)
Mutual labels:  luajit, luarocks
Luafun
Lua Fun is a high-performance functional programming library for Lua designed with LuaJIT's trace compiler in mind.
Stars: ✭ 1,654 (+5068.75%)
Mutual labels:  luajit, luarocks
sqlite.lua
SQLite LuaJIT binding with a very simple api.
Stars: ✭ 291 (+809.38%)
Mutual labels:  luajit, luarocks
Luarocks
LuaRocks is the package manager for the Lua programming language.
Stars: ✭ 2,324 (+7162.5%)
Mutual labels:  luajit, luarocks
Tolua
The fastest unity lua binding solution
Stars: ✭ 2,630 (+8118.75%)
Mutual labels:  luajit
Objective-CPP
C++ compatibility library for Objective-C - Objective-CPP is a library intended to ease software development using Objective-C++. It declares categories on Objective-C classes, to work with the STL C++ types, such as std::string, std::vector, etc.
Stars: ✭ 37 (+15.63%)
Mutual labels:  stdlib
Lua Openssl
Openssl binding for Lua
Stars: ✭ 206 (+543.75%)
Mutual labels:  luajit
Lua Resty Redis Connector
Connection utilities for lua-resty-redis
Stars: ✭ 186 (+481.25%)
Mutual labels:  luajit
nginx-lua
Nginx 1.19+ with LUA support based on Alpine Linux, Amazon Linux, Debian, Fedora and Ubuntu.
Stars: ✭ 112 (+250%)
Mutual labels:  luajit
Lib
Autocode CLI and standard library tooling
Stars: ✭ 3,773 (+11690.63%)
Mutual labels:  stdlib
cli
Autocode CLI and standard library tooling
Stars: ✭ 3,791 (+11746.88%)
Mutual labels:  stdlib
Sol2
Sol3 (sol2 v3.0) - a C++ <-> Lua API wrapper with advanced features and top notch performance - is here, and it's great! Documentation:
Stars: ✭ 2,791 (+8621.88%)
Mutual labels:  luajit
kwstruct
Struct with keyword arguments support
Stars: ✭ 17 (-46.87%)
Mutual labels:  stdlib
Luvi
A project in-between luv and luvit.
Stars: ✭ 215 (+571.88%)
Mutual labels:  luajit
Stdlib
✨ Standard library for JavaScript and Node.js. ✨
Stars: ✭ 2,749 (+8490.63%)
Mutual labels:  stdlib
Luject
🍹A static injector of dynamic library for application (android, iphoneos, macOS, windows, linux)
Stars: ✭ 203 (+534.38%)
Mutual labels:  luajit
stdlib
🎁 Gleam's standard library
Stars: ✭ 153 (+378.13%)
Mutual labels:  stdlib
30daymakeos
《30天自制操作系统》源码中文版。自己制作一个操作系统(OSASK)的过程
Stars: ✭ 4,127 (+12796.88%)
Mutual labels:  stdlib
go-workshops
Go language basic workshops for devz
Stars: ✭ 68 (+112.5%)
Mutual labels:  stdlib

Diagnose uses of undeclared variables

by the strict project Copyright (C) 2010-2023 std.strict authors

License workflow status codecov.io

This is a pure Lua library for detecting access to uninitialized variables from Lua 5.1 (including LuaJIT), 5.2, 5.3 and 5.4. The libraries are copyright by their authors (see the AUTHORS file for details), and released under the MIT license (the same license as Lua itself). There is no warranty.

When using this module, all variables (including functions!) must be declared through a regular assignment (even assigning nil will do) in a strict scope before being used anywhere or assigned to inside a nested scope.

Installation

The simplest and best way to install strict is with LuaRocks. To install the latest release (recommended):

    luarocks install std.strict

To install current git master (for testing, before submitting a bug report for example):

    luarocks install https://raw.githubusercontent.com/lua-stdlib/strict/master/std.strict-git-1.rockspec

The best way to install without LuaRocks is to copy the std/strict directory into your package search path.

Use

The strict package returns a callable, which when called returns a strict environment table that requires all variables be declared before use. For compatibility with Lua > 5.1, you must assign this environment table to _ENV; if necessary, setfenv will be called automatically for compatibility with Lua 5.1 and LuaJIT.

   -- For example, use of the global environment from this scope.
   local _ENV = require 'std.strict' (_G)

   -- Or, prevent all access to global environment.
   local _ENV = require 'std.strict' {}

   -- Or, control access to limited environment from this scope.
   local _ENV = require 'std.strict' {
      setmetatable = setmetatable,
      type = type,
      table_unpack = table.unpack or unpack,
   }

Documentation

The latest release is documented with LDoc. Pre-built HTML files are included in the release tarball.

Bug reports and code contributions

This library is written and maintained by its users.

Please make bug reports and suggestions as GitHub Issues. Pull requests are especially appreciated.

But first, please check that your issue has not already been reported by someone else, and that it is not already fixed by master in preparation for the next release (see Installation section above for how to temporarily install master with LuaRocks).

There is no strict coding style, but please bear in mind the following points when proposing changes:

  1. Follow existing code. There are a lot of useful patterns and avoided traps there.

  2. 3-character indentation using SPACES in Lua sources: It makes rogue TABs easier to see, and lines up nicely with 'if' and 'end' keywords.

  3. Simple strings are easiest to type using single-quote delimiters, saving double-quotes for where a string contains apostrophes.

  4. Save horizontal space by only using SPACES where the parser requires them.

  5. Use vertical space to separate out compound statements to help the coverage reports discover untested lines.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].