aboutsummaryrefslogtreecommitdiff
path: root/tests/common.lua
diff options
context:
space:
mode:
authorMark Pulford <mark@kyne.com.au>2011-12-30 17:48:12 +1030
committerMark Pulford <mark@kyne.com.au>2011-12-30 17:48:12 +1030
commit85bf3b798f6d52c374c35f7fbe47df132891d3b2 (patch)
tree39b0da8e6d6536cdd90038547a985559102962de /tests/common.lua
parent2416b145073211b840781da6abf4b6d97f4657a6 (diff)
downloadlua-cjson-85bf3b798f6d52c374c35f7fbe47df132891d3b2.tar.gz
lua-cjson-85bf3b798f6d52c374c35f7fbe47df132891d3b2.tar.bz2
lua-cjson-85bf3b798f6d52c374c35f7fbe47df132891d3b2.zip
Add support for Lua 5.2 and cjson.new
Update all Lua scripts to use new module init style everywhere: local json = require "cjson" Lua CJSON does not register a global table under Lua 5.2. The global table can be disabled under Lua 5.1 with DISABLE_CJSON_GLOBAL. Other changes: - Store CJSON configuration as an upvalue for each function. - Add "cjson.new" function to create another module table with a separate configuration. - Add _NAME and _VERSION variables.
Diffstat (limited to 'tests/common.lua')
-rw-r--r--tests/common.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/common.lua b/tests/common.lua
index f3dc6f7..7472a10 100644
--- a/tests/common.lua
+++ b/tests/common.lua
@@ -1,4 +1,4 @@
1require "cjson" 1local json = require "cjson"
2 2
3-- Misc routines to assist with CJSON testing 3-- Misc routines to assist with CJSON testing
4-- 4--
@@ -77,8 +77,8 @@ function serialise_value(value, indent, depth)
77 if indent == nil then indent = "" end 77 if indent == nil then indent = "" end
78 if depth == nil then depth = 0 end 78 if depth == nil then depth = 0 end
79 79
80 if value == cjson.null then 80 if value == json.null then
81 return "cjson.null" 81 return "json.null"
82 elseif type(value) == "string" then 82 elseif type(value) == "string" then
83 return string.format("%q", value) 83 return string.format("%q", value)
84 elseif type(value) == "nil" or type(value) == "number" or 84 elseif type(value) == "nil" or type(value) == "number" or