Index: liblua-cjson/lua/cjson/util.lua =================================================================== --- liblua-cjson.orig/lua/cjson/util.lua 2012-08-22 22:21:31.000000000 +0200 +++ liblua-cjson/lua/cjson/util.lua 2012-08-24 10:52:27.000000000 +0200 @@ -146,7 +146,21 @@ end if type1 ~= "table" then - return val1 == val2 + -- Lua 5.2 reports function names more precisely + if _VERSION >= "Lua 5.2" and type1 == "string" then + if val1 == val2 then return true else + local start, stop = string.find(val2, "to '%?'") + if start == nil then return false else + local prefix2 = string.sub(val2,1,start+3) + local postfix2 = string.sub(val2,stop) + local prefix1 = string.sub(val1,1,start+3) + local postfix1 = string.sub(val1,-string.len(postfix2)) + return prefix1 == prefix2 and postfix1 == postfix2 + end + end + else + return val1 == val2 + end end -- check_keys stores all the keys that must be checked in val2