Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
Lua Json
Commits
eef17416
Commit
eef17416
authored
Sep 25, 2020
by
neoxic
Browse files
Cosmetics
parent
5faf49ed
Changes
1
Show whitespace changes
Inline
Side-by-side
test/test-json.lua
View file @
eef17416
...
...
@@ -71,48 +71,48 @@ local function spawn()
return
any
(
0
)
end
local
function
compare
(
v
1
,
v
2
)
local
function
compare
(
x
1
,
x
2
)
local
r
=
{}
local
function
compare
(
v
1
,
v
2
)
if
type
(
v
1
)
~=
'table'
or
type
(
v
2
)
~=
'table'
then
return
v
1
==
v
2
local
function
compare
(
x
1
,
x
2
)
if
type
(
x
1
)
~=
'table'
or
type
(
x
2
)
~=
'table'
then
return
x
1
==
x
2
end
if
v
1
==
v
2
then
if
x
1
==
x
2
then
return
true
end
if
not
compare
(
getmetatable
(
v
1
),
getmetatable
(
v
2
))
then
if
not
compare
(
getmetatable
(
x
1
),
getmetatable
(
x
2
))
then
return
false
end
if
r
[
v
1
]
and
r
[
v
2
]
then
if
r
[
x
1
]
and
r
[
x
2
]
then
return
true
end
r
[
v
1
]
=
true
r
[
v
2
]
=
true
local
function
find
(
t
,
xk
,
xv
)
if
t
[
x
k
]
==
x
v
then
r
[
x
1
]
=
true
r
[
x
2
]
=
true
local
function
find
(
t
,
k_
,
v_
)
if
t
[
k
_
]
==
v
_
then
return
true
end
for
k
,
v
in
pairs
(
t
)
do
if
compare
(
k
,
x
k
)
and
compare
(
v
,
x
v
)
then
if
compare
(
k
,
k
_
)
and
compare
(
v
,
v
_
)
then
return
true
end
end
end
for
k
,
v
in
pairs
(
v
1
)
do
if
not
find
(
v
2
,
k
,
v
)
then
for
k
,
v
in
pairs
(
x
1
)
do
if
not
find
(
x
2
,
k
,
v
)
then
return
false
end
end
for
k
,
v
in
pairs
(
v
2
)
do
if
not
find
(
v
1
,
k
,
v
)
then
for
k
,
v
in
pairs
(
x
2
)
do
if
not
find
(
x
1
,
k
,
v
)
then
return
false
end
end
r
[
v
1
]
=
nil
r
[
v
2
]
=
nil
r
[
x
1
]
=
nil
r
[
x
2
]
=
nil
return
true
end
return
compare
(
v
1
,
v
2
)
return
compare
(
x
1
,
x
2
)
end
local
function
handler
(
t
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment