File lib/strict.lua
Checks uses of undeclared global variables. All global variables must be 'declared' through a regular assignment (even assigning nil will do) in a main chunk before being used anywhere or assigned to inside a function.
Functions
init () | Enable strict checking for the calling environment |
lock () | Prevent creation of new variables in the calling environment. |
strict_locked (t, n, v) | When the table is locked, __newindex shouldn't be called. |
strict_newindex (t, n, v) | new global variables are only allowed in main and in C functions |
Functions
- init ()
- Enable strict checking for the calling environment
- lock ()
- Prevent creation of new variables in the calling environment. This can be used to detect unwanted usage of globals.
- strict_locked (t, n, v)
-
When the table is locked, __newindex shouldn't be called. The only valid possibility is when the variable has been assigned nil, in which case it vanishes, and the next assignment will be a new one.
Parameters
- t:
- n:
- v:
- strict_newindex (t, n, v)
-
new global variables are only allowed in main and in C functions
Parameters
- t:
- n:
- v: