Hey, I’m currently experiencing issues when attempting to Encode Enums in version v0.7
. The specific Enum I’m testing with is Enum.KeyCode.LeftShift
.
Here’s a usage example Serialization.Encode(Enum.KeyCode.LeftShift)
, which results in the error: RBLXSerialize.Convertors:57: attempt to index nil with 'Value'
.
The error seems to be caused because you’re not providing enough arguments for the EnumItem
Convertor.
Value ModuleScript
local convertor = convertors[ ValueType ]
if convertor then
local converted = convertor(true, value)
if converted then
return ValueString .. Binary.describe("DataType",ValueType)..Binary.describe("Value",converted)
else
return nil
end
else
return nil
end
Convertors ModuleScript
["EnumItem"] = function(isClass,API,SubEnum,EnumValue)
if isClass then
return string.pack("I2",EnumValue.Value)
else
return EnumStorage[Enum[SubEnum]][string.unpack("I2",EnumValue)]
end
end,
You’re providing the function function(isClass,API,SubEnum,EnumValue)
only two values convertor(true, value)
. So when return string.pack("I2",EnumValue.Value)
is ran, EnumValue
is nil
.
I went ahead and did a bandaid fix on this, to see if that was the entire issue, but you’re also experiencing a very similar issue when Decoding.
I’m curious, am I using your Library wrong or are these legitimate bugs in your library? I feel like I’m using it wrong because the ‘bugs’ seem so straightforward, it’s as if whenever changes were made to the Enums handling, they were never tested.