aboutsummaryrefslogtreecommitdiff
path: root/manual.txt
diff options
context:
space:
mode:
Diffstat (limited to 'manual.txt')
-rw-r--r--manual.txt28
1 files changed, 20 insertions, 8 deletions
diff --git a/manual.txt b/manual.txt
index 810d3d1..3ccbce3 100644
--- a/manual.txt
+++ b/manual.txt
@@ -48,7 +48,7 @@ Build Options (#define)
48[horizontal] 48[horizontal]
49USE_INTERNAL_ISINF:: Workaround for Solaris platforms missing isinf(). 49USE_INTERNAL_ISINF:: Workaround for Solaris platforms missing isinf().
50DISABLE_CJSON_GLOBAL:: Do not store module table in global "cjson" 50DISABLE_CJSON_GLOBAL:: Do not store module table in global "cjson"
51 variable. 51 variable. Redundant from Lua 5.2 onwards.
52 52
53 53
54Make 54Make
@@ -150,10 +150,10 @@ local cjson = require "cjson"
150local cjson2 = cjson.new() 150local cjson2 = cjson.new()
151------------ 151------------
152 152
153Lua CJSON can be loaded via +require+. A global +cjson+ table is 153Lua CJSON can be loaded via the Lua +require+ function. A global
154registered under Lua 5.1 to maintain backward compatibility. Lua CJSON 154+cjson+ module table is registered under Lua 5.1 to maintain backward
155does not register a global table under Lua 5.2 since this practice is 155compatibility. Lua CJSON does not register a global table under Lua
156discouraged. 1565.2 since this practice is discouraged.
157 157
158+cjson.new+ can be used to instantiate an independent copy of the Lua 158+cjson.new+ can be used to instantiate an independent copy of the Lua
159CJSON module. The new module has a separate persistent encoding 159CJSON module. The new module has a separate persistent encoding
@@ -164,9 +164,21 @@ threads within a single Lua state provided the persistent encoding
164buffer is not shared. This can be achieved by one of the following 164buffer is not shared. This can be achieved by one of the following
165methods: 165methods:
166 166
167- Disabling the persistent encoding buffer with +encode_keep_buffer+. 167- Disabling the persistent encoding buffer with
168- Ensuring only a single thread calls +encode+ at a time. 168 +cjson.encode_keep_buffer+.
169- Using a separate +cjson+ instantiation per pre-emptive thread. 169- Ensuring each thread calls +cjson.encode+ at a time.
170- Using a separate +cjson+ module table per pre-emptive thread
171 (+cjson.new+).
172
173[NOTE]
174Lua CJSON uses ++strtod++(3) and ++snprintf++(3) to perform numeric
175conversion as they are usually well supported, fast and bug free.
176However, these functions require a workaround for JSON
177encoding/parsing under locales using a comma decimal separator. Lua
178CJSON detects the current locale during instantiation to determine
179whether a workaround is required. CJSON should be reinitialised via
180+cjson.new+ if the locale of the current process changes. Different
181locales per thread are not supported.
170 182
171 183
172decode 184decode