mediawiki-extensions-Scribunto/includes/Engines/LuaCommon/lualib
Kunal Mehta 829c53ef05 Add strict.lua to replace "Module:No globals"
For the most part, it is a good idea to avoid global variables and use
`local` variables instead. Quoting from the ScopeTutorial[1], "The
general rule is to always use local variables, unless it's necessary for
every part of your program to be able to access the variable (which is
very rare)."

Wikimedia module authors have written "Module:No globals", which errors
on the use of any global variable. On the English Wikipedia, this is
used on 32% of pages (18 million). Wikidata[2] indicates that it's been
copied to 334 other wikis.

Lua itself distributes an extra named "strict.lua"[3], which is what
this is based off of. Similar to bit32.lua, this is a pure-Lua library
that can be imported/enabled with `require( "strict" )` at the top of a
module.

The two changes I made from Lua's strict is to exempt the `arg` key,
which is used internally by Scribunto, and remove `what()`, since we
don't enable access to `debug.getinfo()` for security reasons.

[1] https://lua-users.org/wiki/ScopeTutorial
[2] https://www.wikidata.org/wiki/Q16748603
[3] http://www.lua.org/extras/5.1/strict.lua

Bug: T209310
Change-Id: I46ee6f630ac6b26c68c31becd1f3b9d961bcab29
2022-10-13 04:39:21 +00:00
..
luabit Capitalise Engines folder 2022-09-30 00:58:27 +00:00
ustring Capitalise Engines folder 2022-09-30 00:58:27 +00:00
bit32.lua Capitalise Engines folder 2022-09-30 00:58:27 +00:00
libraryUtil.lua Capitalise Engines folder 2022-09-30 00:58:27 +00:00
mw.hash.lua Hide mw.hash.setupInterface from users 2022-10-08 22:01:00 +00:00
mw.html.lua Capitalise Engines folder 2022-09-30 00:58:27 +00:00
mw.language.lua Capitalise Engines folder 2022-09-30 00:58:27 +00:00
mw.lua Capitalise Engines folder 2022-09-30 00:58:27 +00:00
mw.message.lua Capitalise Engines folder 2022-09-30 00:58:27 +00:00
mw.site.lua Capitalise Engines folder 2022-09-30 00:58:27 +00:00
mw.text.lua Capitalise Engines folder 2022-09-30 00:58:27 +00:00
mw.title.lua Capitalise Engines folder 2022-09-30 00:58:27 +00:00
mw.uri.lua Capitalise Engines folder 2022-09-30 00:58:27 +00:00
mw.ustring.lua Capitalise Engines folder 2022-09-30 00:58:27 +00:00
mwInit.lua Capitalise Engines folder 2022-09-30 00:58:27 +00:00
package.lua Capitalise Engines folder 2022-09-30 00:58:27 +00:00
strict.lua Add strict.lua to replace "Module:No globals" 2022-10-13 04:39:21 +00:00