Board Thread:Lua Help/@comment-27393108-20160204065606/@comment-24473195-20160204095224

Mazn wrote: Alright. That's disappointing.

But then... what IS the global namespace? The global namespace is where internal libraries and variables are stored, see this :

"I fail to see the difference between local script variables and global variables if both only exist within the scope of the script instance..."
 * http://www.lua.org/pil/15.4.html

MediaWiki can store some extra variables in the global namespace, and that's where the mw.text et al. are stored. Use of globals also affects performance:
 * http://lua-users.org/wiki/LocalsVsGlobals
 * https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#require
 * http://stackoverflow.com/questions/9132288/why-are-local-variables-accessed-faster-than-global-variables-in-lua

I can entirely understand where you are coming from, and also tried some wild and crazy stuff using the variable extension and lua. Ultimately it seemed that the best approach is to separate the data from the page, and format it using lua. It really becomes quite messy when one tries to use variables in a page. Not to mention the fact that it makes the page way slower.