mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Scribunto
synced 2024-11-24 08:14:09 +00:00
Use do...end to restrict scope
Creating and calling an anonymous function to create a scope is prone to breakage, and only works because the last token before it is a numeric literal. Do...end is designed for this purpose, so use it instead. Change-Id: Ic33321086d5469bf97301b434c5a660f04120662
This commit is contained in:
parent
35ee461a0b
commit
e19a1404f4
|
@ -10,7 +10,7 @@ local loadedData = {}
|
|||
local executeFunctionDepth = 0
|
||||
|
||||
-- Extend pairs and ipairs to recognize __pairs and __ipairs, if they don't already
|
||||
( function ()
|
||||
do
|
||||
local t = {}
|
||||
setmetatable( t, { __pairs = function() return 1, 2, 3 end } )
|
||||
local f = pairs( t )
|
||||
|
@ -28,7 +28,7 @@ local executeFunctionDepth = 0
|
|||
return f, s, var
|
||||
end
|
||||
end
|
||||
end )()
|
||||
end
|
||||
|
||||
--- Put an isolation-friendly package module into the specified environment
|
||||
-- table. The package module will have an empty cache, because caching of
|
||||
|
|
Loading…
Reference in a new issue