lua - check if userdata is nil

101 Views Asked by At

I trying to use lua cjson to parse to following json :

 {
       "data" : null,
         "message" : "Your session has expired. Please login again.",
           "code" : "390112",
             "success" : false
 }

it's parsed to the following map :

{ ["message"] = Your session has expired. Please login again.,["success"] = false,["data"] = userdata: (nil),["code"] = 390112,}

and i trying to to do something like:

if decoded["data"] == nil or decoded["data"] ==userdata(nil)  then
  return 
end

is that possible?

(userdata(nil) is not valid expression )

0

There are 0 best solutions below