To add value type Foobar:
- rbxfile
values.go- Add
TypeFoobarto Type constants. - In
typeStrings, mapTypeFoobarto string"Foobar". - In
valueGenerators, mapTypeFoobarto functionnewValueFoobar. - Create
ValueFoobartype.- Add
ValueFoobartype with appropriate underlying type. - Implement
newValueFoobarfunction (func() Value) - Implement
Type() Typemethod.- Return
TypeFoobar.
- Return
- Implement
String() stringmethod.- Return string representation of value that is similar to the
results of Roblox's
tostringfunction.
- Return string representation of value that is similar to the
results of Roblox's
- Implement
Copy() Valuemethod.- Must return a deep copy of the underlying value.
- Add
- Add
values_test.go- ...
- declare
declare/type.go- Add
Foobarto type constants.- Ensure
Foobardoes not conflict with existing identifiers.
- Ensure
- In
typeStrings, mapFoobarto string"Foobar". - In function
assertValue, add caseFoobar.- Assert
vasrbxfile.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 ofFoobarcase inType.valuemethod.
- In function
declare/declare_test.go- ...
- json
json/json.go- In function
ValueToJSONInterface, add caserbxfile.ValueFoobar.- Convert
rbxfile.ValueFoobarto 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
GetCanonTypeadd case"foobar"(lowercase).- Returns
"Foobar"
- Returns
- In method
rdecoder.getValue, add case"Foobar".- Receives
tag *Tag, must returnrbxfile.ValueFoobar. componentscan be used to map subtags to value fields.
- Receives
- In method
rencoder.encodeProperty, add caserbxfile.ValueFoobar.- Returns
*Tagthat is decodable byrdecoder.getValue.
- Returns
- In function
isCanonType, add caserbxfile.ValueFoobar.
- In function
- rbxl
rbxl/values.go- Add
TypeFoobarto type constants. - In
Stringmethod, add caseTypeFoobarthat returns"Foobar". - In
ValueTypemethod, add caseTypeFoobarthat returnsrbxfile.TypeFoobar. - In
FromValueTypefunction, add caserbxfile.TypeFoobarthat returnsTypeFoobar. - In
NewValue, add caseTypeFoobarthat returnsnew(ValueFoobar). - Create
ValueFoobartype.- Add
ValueFoobarwith appropriate underlying type. - Implement
Type() Typemethod.- Returns
TypeFoobar.
- Returns
- Implement
Bytes.- Converts a single
ValueFoobarto 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
ValueFoobarmust be interleaved, implementfielderinterface.- 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
iusing bytes fromb.
- Sets field number
- Implement
fieldGet.- Returns field number
ias a slice of bytes.
- Returns field number
- Implement
- Add
- Add
rbxl/codec.go- In function
decodeValue, add case*ValueFoobar.- Converts
*ValueFoobartorbxfile.ValueFoobar.
- Converts
- In function
encodeValue, add caserbxfile.ValueFoobar.- Converts
rbxfile.ValueFoobarto*ValueFoobar.
- Converts
- In function
rbxl/arrays.go- In function
ValuesToBytes, add caseTypeFoobar.- Converts a slice of
ValueFoobarto a slice of bytes. - If fields
ValueFoobarmust 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, usedeinterleaveFields`.
- Converts a slice of bytes to a slice of
- In function