jsonHelper.lua utility file - VanaDev/Vana GitHub Wiki
Category: Utility Lua-Based Scripts
Type: number
Notes: Used as a return value from the serialize functions to indicate an error has occurred. The result will be the error message instead of serialized/deserialized data in this case.
Type: number
Notes: Used as a return value from the serialize functions to indicate no error has occurred. The result will be serialized/deserialized data in this case.
Return(s):
- serializeResultCode: number
- serializeResult: string
- value: any
Usage:
val = { ["key"] = 123, ["value"] = 456 }; result, data = serialize(val); if result == serialize_err then print("Error: " .. data); else -- Here, data should be a string roughly equivalent to {key: 123, value: 456} end
Return(s):
- serializeResultCode: number
- serializeResult: string
- value: string
Usage:
json = "{key: 123, value: 456}"; result, data = deserialize(val); if result == serialize_err then print("Error: " .. data); else -- Here, data should be a value roughly equivalent to { ["key"] = 123, ["value"] = 456 } end