lune-org/lune

Null values decoded by Serde return as an empty userdata instead of nil

Closed this issue · 1 comments

ayuka commented

Problem
Null values within data decoded by Serde does not properly result in a nil value, but instead a blank userdata object. This occurs on the latest release of Lune 0.7.5.

Expected Behavior
json.a and yaml.a should be nil

Repro Code

local serde = require("@lune/serde")

local json = serde.decode("json", [[
    {
        "a": null
    }
]])

local yaml = serde.decode("yaml", [[
    a: null
]])

print("json", tostring(json.a)) --> json userdata: 0x0000000000000000
print("yaml", tostring(yaml.a)) --> yaml userdata: 0x0000000000000000

Fixed for the next release in commit b4c3cc7