From 7f42a7245663169e3c514967cf738582a802533d Mon Sep 17 00:00:00 2001 From: Thomas Harning Jr Date: Wed, 9 Jan 2013 20:42:05 -0500 Subject: [PATCH] all: sets _ENV to nil using local _ENV = nil to avoid global writing --- lua/json.lua | 2 +- lua/json/decode.lua | 2 +- lua/json/decode/composite.lua | 2 +- lua/json/decode/number.lua | 2 +- lua/json/decode/others.lua | 2 +- lua/json/decode/state.lua | 2 +- lua/json/decode/strings.lua | 2 +- lua/json/decode/util.lua | 2 +- lua/json/encode.lua | 2 +- lua/json/encode/array.lua | 2 +- lua/json/encode/calls.lua | 2 +- lua/json/encode/number.lua | 2 +- lua/json/encode/object.lua | 2 +- lua/json/encode/others.lua | 2 +- lua/json/encode/output.lua | 2 +- lua/json/encode/output_utility.lua | 2 +- lua/json/encode/strings.lua | 2 +- lua/json/util.lua | 2 +- 18 files changed, 18 insertions(+), 18 deletions(-) diff --git a/lua/json.lua b/lua/json.lua index bfbbaff..b3e5400 100644 --- a/lua/json.lua +++ b/lua/json.lua @@ -8,7 +8,7 @@ local util = require("json.util") local _G = _G -_ENV = nil +local _ENV = nil local json = { _VERSION = "1.3", diff --git a/lua/json/decode.lua b/lua/json/decode.lua index 739c2e8..b2c357c 100644 --- a/lua/json/decode.lua +++ b/lua/json/decode.lua @@ -22,7 +22,7 @@ local type = type local require = require -_ENV = nil +local _ENV = nil local modulesToLoad = { "composite", diff --git a/lua/json/decode/composite.lua b/lua/json/decode/composite.lua index 945397f..cd9c289 100644 --- a/lua/json/decode/composite.lua +++ b/lua/json/decode/composite.lua @@ -18,7 +18,7 @@ local tostring = tostring local error = error local getmetatable = getmetatable -_ENV = nil +local _ENV = nil local defaultOptions = { array = { diff --git a/lua/json/decode/number.lua b/lua/json/decode/number.lua index bcef556..94ed3b8 100644 --- a/lua/json/decode/number.lua +++ b/lua/json/decode/number.lua @@ -8,7 +8,7 @@ local jsonutil = require("json.util") local merge = jsonutil.merge local util = require("json.decode.util") -_ENV = nil +local _ENV = nil local digit = lpeg.R("09") local digits = digit^1 diff --git a/lua/json/decode/others.lua b/lua/json/decode/others.lua index adc3ea6..9fab7a8 100644 --- a/lua/json/decode/others.lua +++ b/lua/json/decode/others.lua @@ -9,7 +9,7 @@ local util = require("json.decode.util") -- Container module for other JavaScript types (bool, null, undefined) -_ENV = nil +local _ENV = nil -- For null and undefined, use the util.null value to preserve null-ness local booleanCapture = diff --git a/lua/json/decode/state.lua b/lua/json/decode/state.lua index 8a2f8fa..50556f8 100644 --- a/lua/json/decode/state.lua +++ b/lua/json/decode/state.lua @@ -10,7 +10,7 @@ local type = type local next = next local unpack = unpack -_ENV = nil +local _ENV = nil local state_ops = {} local state_mt = { diff --git a/lua/json/decode/strings.lua b/lua/json/decode/strings.lua index d0e796e..1e91836 100644 --- a/lua/json/decode/strings.lua +++ b/lua/json/decode/strings.lua @@ -14,7 +14,7 @@ local table_concat = require("table").concat local error = error -_ENV = nil +local _ENV = nil local function get_error(item) local fmt_string = item .. " in string [%q] @ %i:%i" diff --git a/lua/json/decode/util.lua b/lua/json/decode/util.lua index 2249eba..857bf0c 100644 --- a/lua/json/decode/util.lua +++ b/lua/json/decode/util.lua @@ -17,7 +17,7 @@ local table_concat = require("table").concat local merge = require("json.util").merge -_ENV = nil +local _ENV = nil local function get_invalid_character_info(input, index) local parsed = input:sub(1, index) diff --git a/lua/json/encode.lua b/lua/json/encode.lua index 0d59150..e07a6b8 100644 --- a/lua/json/encode.lua +++ b/lua/json/encode.lua @@ -14,7 +14,7 @@ local output = require("json.encode.output") local util = require("json.util") local util_merge, isCall = util.merge, util.isCall -_ENV = nil +local _ENV = nil --[[ List of encoding modules to load. diff --git a/lua/json/encode/array.lua b/lua/json/encode/array.lua index 4efee1b..3744409 100644 --- a/lua/json/encode/array.lua +++ b/lua/json/encode/array.lua @@ -16,7 +16,7 @@ local math_floor, math_modf = math.floor, math.modf local jsonutil = require("json.util") local util_IsArray = jsonutil.IsArray -_ENV = nil +local _ENV = nil local defaultOptions = { isArray = util_IsArray diff --git a/lua/json/encode/calls.lua b/lua/json/encode/calls.lua index 7d0cee2..11dddfe 100644 --- a/lua/json/encode/calls.lua +++ b/lua/json/encode/calls.lua @@ -13,7 +13,7 @@ local jsonutil = require("json.util") local isCall, decodeCall = jsonutil.isCall, jsonutil.decodeCall -_ENV = nil +local _ENV = nil local defaultOptions = { } diff --git a/lua/json/encode/number.lua b/lua/json/encode/number.lua index 6240e6a..290b440 100644 --- a/lua/json/encode/number.lua +++ b/lua/json/encode/number.lua @@ -7,7 +7,7 @@ local assert = assert local jsonutil = require("json.util") local huge = require("math").huge -_ENV = nil +local _ENV = nil local defaultOptions = { nan = true, diff --git a/lua/json/encode/object.lua b/lua/json/encode/object.lua index c4c1d7f..4716d52 100644 --- a/lua/json/encode/object.lua +++ b/lua/json/encode/object.lua @@ -11,7 +11,7 @@ local tostring = tostring local table_concat = require("table").concat local jsonutil = require("json.util") -_ENV = nil +local _ENV = nil local defaultOptions = { } diff --git a/lua/json/encode/others.lua b/lua/json/encode/others.lua index 441d1c2..b527044 100644 --- a/lua/json/encode/others.lua +++ b/lua/json/encode/others.lua @@ -8,7 +8,7 @@ local assert = assert local jsonutil = require("json.util") local type = type -_ENV = nil +local _ENV = nil -- Shortcut that works local encodeBoolean = tostring diff --git a/lua/json/encode/output.lua b/lua/json/encode/output.lua index 2eea3ff..8293b62 100644 --- a/lua/json/encode/output.lua +++ b/lua/json/encode/output.lua @@ -13,7 +13,7 @@ local setmetatable = setmetatable local output_utility = require("json.encode.output_utility") -_ENV = nil +local _ENV = nil local tableCompositeCache = setmetatable({}, {__mode = 'v'}) diff --git a/lua/json/encode/output_utility.lua b/lua/json/encode/output_utility.lua index 2d3941d..b6607d1 100644 --- a/lua/json/encode/output_utility.lua +++ b/lua/json/encode/output_utility.lua @@ -5,7 +5,7 @@ local setmetatable = setmetatable local assert, loadstring = assert, loadstring or load -_ENV = nil +local _ENV = nil -- Key == weak, if main key goes away, then cache cleared local outputCache = setmetatable({}, {__mode = 'k'}) diff --git a/lua/json/encode/strings.lua b/lua/json/encode/strings.lua index 65597cc..09d85a9 100644 --- a/lua/json/encode/strings.lua +++ b/lua/json/encode/strings.lua @@ -8,7 +8,7 @@ local pairs = pairs local jsonutil = require("json.util") local util_merge = jsonutil.merge -_ENV = nil +local _ENV = nil local normalEncodingMap = { ['"'] = '\\"', diff --git a/lua/json/util.lua b/lua/json/util.lua index dfdbf3b..6ceb759 100644 --- a/lua/json/util.lua +++ b/lua/json/util.lua @@ -9,7 +9,7 @@ local pairs = pairs local getmetatable, setmetatable = getmetatable, setmetatable local select = select -_ENV = nil +local _ENV = nil local function foreach(tab, func) for k, v in pairs(tab) do -- 2.11.4.GIT