-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJSON.lua.patch
More file actions
40 lines (32 loc) · 1.11 KB
/
JSON.lua.patch
File metadata and controls
40 lines (32 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
--- JSON.lua.orig Ïí ×åð 18 12:33:36 2012
+++ JSON.lua Ïí ×åð 18 12:29:11 2012
@@ -150,7 +150,14 @@
local isArray = { __tostring = function() return "JSON array" end } isArray.__index = isArray
local isObject = { __tostring = function() return "JSON object" end } isObject.__index = isObject
+local isNull = { __tostring = function() return "JSON null" end } isNull.__index = isNull
+OBJDEF.NULL = { }
+
+function OBJDEF:newNull()
+ return setmetatable(OBJDEF.NULL, isNull)
+end
+
function OBJDEF:newArray(tbl)
return setmetatable(tbl or {}, isArray)
end
@@ -431,10 +438,12 @@
end
local text_len = text:len()
+ local tableIdx = 1
while i <= text_len do
local val, new_i = grok_one(self, text, i)
- table.insert(VALUE, val)
+ table.insert(VALUE, tableIdx, val)
+ tableIdx = tableIdx + 1
i = skip_whitespace(text, new_i)
@@ -481,7 +490,7 @@
return false, start + 5
elseif text:find('^null', start) then
- return nil, start + 4
+ return self:newNull(), start + 4
else
self:onDecodeError("can't parse JSON", text, start, etc)