| 1 |
Index: liblua-cjson/lua/cjson/util.lua |
| 2 |
=================================================================== |
| 3 |
--- liblua-cjson.orig/lua/cjson/util.lua 2012-08-22 22:21:31.000000000 +0200 |
| 4 |
+++ liblua-cjson/lua/cjson/util.lua 2012-08-24 10:52:27.000000000 +0200 |
| 5 |
@@ -146,7 +146,21 @@ |
| 6 |
end |
| 7 |
|
| 8 |
if type1 ~= "table" then |
| 9 |
- return val1 == val2 |
| 10 |
+ -- Lua 5.2 reports function names more precisely |
| 11 |
+ if _VERSION >= "Lua 5.2" and type1 == "string" then |
| 12 |
+ if val1 == val2 then return true else |
| 13 |
+ local start, stop = string.find(val2, "to '%?'") |
| 14 |
+ if start == nil then return false else |
| 15 |
+ local prefix2 = string.sub(val2,1,start+3) |
| 16 |
+ local postfix2 = string.sub(val2,stop) |
| 17 |
+ local prefix1 = string.sub(val1,1,start+3) |
| 18 |
+ local postfix1 = string.sub(val1,-string.len(postfix2)) |
| 19 |
+ return prefix1 == prefix2 and postfix1 == postfix2 |
| 20 |
+ end |
| 21 |
+ end |
| 22 |
+ else |
| 23 |
+ return val1 == val2 |
| 24 |
+ end |
| 25 |
end |
| 26 |
|
| 27 |
-- check_keys stores all the keys that must be checked in val2 |