aboutsummaryrefslogtreecommitdiff
path: root/tests/encode.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/encode.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/encode.lua')
-rwxr-xr-xtests/encode.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/encode.lua b/tests/encode.lua
index f13787c..a8d749a 100755
--- a/tests/encode.lua
+++ b/tests/encode.lua
@@ -7,7 +7,7 @@
7-- ./encode.lua lua_data.lua 7-- ./encode.lua lua_data.lua
8 8
9require "common" 9require "common"
10require "cjson" 10local json = require "cjson"
11 11
12function get_lua_table(file) 12function get_lua_table(file)
13 local func = loadstring("data = " .. file_load(file)) 13 local func = loadstring("data = " .. file_load(file))
@@ -23,6 +23,6 @@ function get_lua_table(file)
23end 23end
24 24
25local t = get_lua_table(arg[1]) 25local t = get_lua_table(arg[1])
26print(cjson.encode(t)) 26print(json.encode(t))
27 27
28-- vi:ai et sw=4 ts=4: 28-- vi:ai et sw=4 ts=4: