To add value type Foobar
:
- rbxfile
values.go
- Add
TypeFoobar
to Type constants. - In
typeStrings
, mapTypeFoobar
to string"Foobar"
. - In
valueGenerators
, mapTypeFoobar
to functionnewValueFoobar
. - Create
ValueFoobar
type.- Add
ValueFoobar
type with appropriate underlying type. - Implement
newValueFoobar
function (func() Value
) - Implement
Type() Type
method.- Return
TypeFoobar
.
- Return
- Implement
String() string
method.- Return string representation of value that is similar to the
results of Roblox's
tostring
function.
- Return string representation of value that is similar to the
results of Roblox's
- Implement
Copy() Value
method.- Must return a deep copy of the underlying value.
- Add
- Add
values_test.go
- ...
- declare
declare/type.go
- Add
Foobar
to type constants.- Ensure
Foobar
does not conflict with existing identifiers.
- Ensure
- In
typeStrings
, mapFoobar
to string"Foobar"
. - In function
assertValue
, add caseFoobar
.- Assert
v
asrbxfile.ValueFoobar
.
- Assert
- In method
Type.value
, add caseFoobar
.- Convert slice of arbitrary values to a
rbxfile.ValueFoobar
.
- Convert slice of arbitrary values to a
- Add
declare/declare.go
- In function
Property
, document behavior ofFoobar
case inType.value
method.
- In function
declare/declare_test.go
- ...
- json
json/json.go
- In function
ValueToJSONInterface
, add caserbxfile.ValueFoobar
.- Convert
rbxfile.ValueFoobar
to generic JSON interface.
- Convert
- In function
ValueFromJSONInterface
, add caserbxfile.TypeFoobar
.- Convert generic JSON interface to
rbxfile.ValueFoobar
.
- Convert generic JSON interface to
- In function
- rbxlx
rbxlx/codec.go
- In function
GetCanonType
add case"foobar"
(lowercase).- Returns
"Foobar"
- Returns
- In method
rdecoder.getValue
, add case"Foobar"
.- Receives
tag *Tag
, must returnrbxfile.ValueFoobar
. components
can be used to map subtags to value fields.
- Receives
- In method
rencoder.encodeProperty
, add caserbxfile.ValueFoobar
.- Returns
*Tag
that is decodable byrdecoder.getValue
.
- Returns
- In function
isCanonType
, add caserbxfile.ValueFoobar
.
- In function
- rbxl
rbxl/values.go
- Add
TypeFoobar
to type constants. - In
String
method, add caseTypeFoobar
that returns"Foobar"
. - In
ValueType
method, add caseTypeFoobar
that returnsrbxfile.TypeFoobar
. - In
FromValueType
function, add caserbxfile.TypeFoobar
that returnsTypeFoobar
. - In
NewValue
, add caseTypeFoobar
that returnsnew(ValueFoobar)
. - Create
ValueFoobar
type.- Add
ValueFoobar
with appropriate underlying type. - Implement
Type() Type
method.- Returns
TypeFoobar
.
- Returns
- Implement
Bytes
.- Converts a single
ValueFoobar
to a slice of bytes.
- Converts a single
- Implement
FromBytes
.- Converts a slice of bytes to a single
ValueFoobar
.
- Converts a slice of bytes to a single
- If fields of
ValueFoobar
must be interleaved, implementfielder
interface.- Implement
fieldLen
.- Returns the byte size of each field.
- Update maxFieldLen if the length of the returned slice is greater.
- Implement
fieldSet
.- Sets field number
i
using bytes fromb
.
- Sets field number
- Implement
fieldGet
.- Returns field number
i
as a slice of bytes.
- Returns field number
- Implement
- Add
- Add
rbxl/codec.go
- In function
decodeValue
, add case*ValueFoobar
.- Converts
*ValueFoobar
torbxfile.ValueFoobar
.
- Converts
- In function
encodeValue
, add caserbxfile.ValueFoobar
.- Converts
rbxfile.ValueFoobar
to*ValueFoobar
.
- Converts
- In function
rbxl/arrays.go
- In function
ValuesToBytes
, add caseTypeFoobar
.- Converts a slice of
ValueFoobar
to a slice of bytes. - If fields
ValueFoobar
must be interleaved, useinterleaveFields
.
- Converts a slice of
- In function
ValuesFromBytes
, add caseTypeFoobar
.- Converts a slice of bytes to a slice of
ValueFoobar
. - If fields of ValueFoobar
are interleaved, use
deinterleaveFields`.
- Converts a slice of bytes to a slice of
- In function