Skip to content

Commit

Permalink
remove conditioanl (is_52) code
Browse files Browse the repository at this point in the history
for not breaking user code, currently always pollute the global,
but we must encourage the new idiom
    local json = require 'json'
instead of
    require 'json'
  • Loading branch information
fperrad committed Feb 27, 2012
1 parent 75fb510 commit d4e846b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/LuaJSON.txt
Expand Up @@ -10,7 +10,7 @@ luajson - JSON encoder/decoder for Lua

SYNOPSIS
--------
require("json")
local json = require("json")

json.decode("json-string" [, parameters])

Expand Down
7 changes: 2 additions & 5 deletions lua/json.lua
Expand Up @@ -6,8 +6,6 @@ local decode = require("json.decode")
local encode = require("json.encode")
local util = require("json.util")

local is_52 = _VERSION == "Lua 5.2"

local _G = _G

_ENV = nil
Expand All @@ -18,7 +16,6 @@ local json = {
util = util
}

if not is_52 then
_G.json = json
end
_G.json = json

return json

0 comments on commit d4e846b

Please sign in to comment.