Documentation ¶
Index ¶
- Variables
- func Intable(v interface{}) (i int64, ok bool)
- func Numberable(v interface{}) (n float64, ok bool)
- func Stringable(v interface{}) (s string, ok bool)
- type Array
- type AttrConfig
- type CallbackDesc
- type ClassDesc
- type Color3uint8
- type Cookie
- type Cookies
- type DescAction
- type DescActions
- type DescFields
- type Dictionary
- type Enum
- type EnumDesc
- type EnumItem
- type EnumItemDesc
- type Enums
- type EventDesc
- type FormatSelector
- type FunctionDesc
- type HTTPHeaders
- type HTTPOptions
- type HTTPResponse
- type Instance
- func (inst *Instance) AddChild(child *Instance) error
- func (inst *Instance) AddChildAt(index int, child *Instance) error
- func (inst *Instance) AttrConfig() *AttrConfig
- func (inst *Instance) Children() []*Instance
- func (inst *Instance) Clone() *Instance
- func (inst *Instance) Copy() types.PropValue
- func (inst *Instance) Desc() *RootDesc
- func (inst *Instance) Descend(names ...string) *Instance
- func (inst *Instance) Descendants() []*Instance
- func (inst *Instance) FindFirstAncestor(name string) *Instance
- func (inst *Instance) FindFirstAncestorOfClass(class string) *Instance
- func (inst *Instance) FindFirstAncestorWhichIsA(class string) *Instance
- func (inst *Instance) FindFirstChild(name string, recurse bool) *Instance
- func (inst *Instance) FindFirstChildOfClass(class string, recurse bool) *Instance
- func (inst *Instance) FindFirstChildWhichIsA(class string, recurse bool) *Instance
- func (inst *Instance) ForEachChild(cb func(child *Instance) error) error
- func (inst *Instance) ForEachDescendant(cb func(desc *Instance) error) error
- func (inst *Instance) ForEachProperty(cb func(name string, value types.PropValue) error) error
- func (inst *Instance) Get(property string) (value types.PropValue)
- func (inst *Instance) GetFullName() string
- func (inst *Instance) IsA(className string) bool
- func (inst *Instance) IsAncestorOf(descendant *Instance) bool
- func (inst *Instance) IsDataModel() bool
- func (inst *Instance) IsDescendantOf(ancestor *Instance) bool
- func (inst *Instance) Metadata() map[string]string
- func (inst *Instance) Name() string
- func (inst *Instance) Parent() *Instance
- func (inst *Instance) Properties() map[string]types.PropValue
- func (inst *Instance) PropertyNames() []string
- func (inst *Instance) RawAttrConfig() (attrcfg *AttrConfig, blocked bool)
- func (inst *Instance) RawDesc() (desc *RootDesc, blocked bool)
- func (inst *Instance) RemoveAll()
- func (inst *Instance) RemoveChild(child *Instance) *Instance
- func (inst *Instance) RemoveChildAt(index int) *Instance
- func (inst *Instance) RemoveChildAtFast(index int) *Instance
- func (inst *Instance) RemoveChildFast(child *Instance) *Instance
- func (inst *Instance) Set(property string, value types.PropValue)
- func (inst *Instance) SetAttrConfig(attrcfg *AttrConfig, blocked bool)
- func (inst *Instance) SetDesc(root *RootDesc, blocked bool)
- func (inst *Instance) SetName(name string)
- func (inst *Instance) SetParent(parent *Instance) error
- func (inst *Instance) SetProperties(props map[string]types.PropValue, replace bool)
- func (inst *Instance) String() string
- func (*Instance) Type() string
- func (inst *Instance) WithDescFindFirstAncestorWhichIsA(globalDesc *RootDesc, class string) *Instance
- func (inst *Instance) WithDescFindFirstChildWhichIsA(globalDesc *RootDesc, class string, recurse bool) *Instance
- func (inst *Instance) WithDescIsA(globalDesc *RootDesc, className string) bool
- type MemberDesc
- type NewItem
- type NilType
- type Objects
- type Optional
- type ParameterDesc
- type PropertyDesc
- type RBXAssetOptions
- type RootDesc
- func (d *RootDesc) Class(name string) (class *rbxdump.Class)
- func (d *RootDesc) ClassIsA(class, superclass string) bool
- func (d *RootDesc) Copy() *RootDesc
- func (d *RootDesc) Enum(name string) (enum *rbxdump.Enum)
- func (d *RootDesc) EnumItem(enum, name string) (item *rbxdump.EnumItem)
- func (d *RootDesc) GenerateEnumTypes()
- func (d *RootDesc) Member(class, name string) (member rbxdump.Member)
- func (d *RootDesc) Of(inst *Instance) *RootDesc
- func (d *RootDesc) Property(class, name string) *rbxdump.Property
- func (d *RootDesc) String() string
- func (*RootDesc) Type() string
- type Symbol
- type Table
- type Tuple
- type TypeDesc
- type UniqueId
Constants ¶
This section is empty.
Variables ¶
var SkipChildren = errors.New("skip children")
SkipChildren causes Instance.ForEachDescendant to skip iterating an instance's children.
Functions ¶
func Intable ¶ added in v0.5.0
Intable returns Value as an integer. ok is false if the value could not be converted. Types that can be converted are the built-in numeric types, as well as any value implementing types.Intlike or types.Numberlike.
func Numberable ¶ added in v0.5.0
Numberable returns v as a floating-point number. ok is false if the value could not be converted. Types that can be converted are the built-in numeric types, as well as any value implementing types.Numberlike or types.Intlike.
func Stringable ¶ added in v0.5.0
Stringable returns v as a string. ok is false if the value could not be converted. Types that can be converted are the built-in string, []byte, and []rune, as well as any value implementing types.Stringlike.
Additionally, an Instance can be converted if it has a particular ClassName, and a selected property implements types.Stringlike:
ClassName | Property ------------------|--------- LocalizationTable | Contents LocalScript | Source ModuleScript | Source Script | Source
Types ¶
type Array ¶
Array is a list of types.Values that itself implements types.Value. It corresponds to the Array type in Roblox.
type AttrConfig ¶ added in v0.4.0
type AttrConfig struct { // Property is the name of the property to which attributes will be // serialized. An empty string defaults to "AttributesSerialize". Property string }
AttrConfig configures an Instance's attributes API.
func (*AttrConfig) Of ¶ added in v0.6.0
func (a *AttrConfig) Of(inst *Instance) *AttrConfig
Of returns the AttrConfig of an instance. If inst is nil, a is returned.
func (*AttrConfig) String ¶ added in v0.4.0
func (*AttrConfig) String() string
String returns a string representation of the value.
func (*AttrConfig) Type ¶ added in v0.4.0
func (*AttrConfig) Type() string
Type returns a string identifying the type of the value.
type CallbackDesc ¶
CallbackDesc wraps a rbxdump.Callback to implement types.Value.
func (CallbackDesc) Type ¶
func (CallbackDesc) Type() string
Type returns a string identifying the type of the value.
type Color3uint8 ¶
Color3uint8 wraps a Color3 value to be interpreted as the Color3uint8 Roblox type.
func (Color3uint8) Alias ¶
func (c Color3uint8) Alias() types.Value
Alias returns the underlying Color3 value.
func (Color3uint8) Copy ¶
func (c Color3uint8) Copy() types.PropValue
Copy returns a copy of the value.
func (Color3uint8) String ¶
func (c Color3uint8) String() string
String returns a string representation of the value.
func (Color3uint8) Type ¶
func (Color3uint8) Type() string
Type returns a string indicating the type of the value.
type Cookie ¶ added in v0.5.0
type DescAction ¶
DescAction wraps a diff.Action to implement types.Value.
func (*DescAction) String ¶
func (a *DescAction) String() string
String returns a string representation of the value.
func (*DescAction) Type ¶
func (*DescAction) Type() string
Type returns a string identifying the type of the value.
type DescActions ¶
type DescActions []*DescAction
DescActions is a list of DescAction values that implements types.Value.
func (DescActions) Type ¶
func (DescActions) Type() string
Type returns a string identifying the type of the value.
type DescFields ¶ added in v0.8.0
DescFields wraps a rbxdump.Fields to implement types.Value.
func (DescFields) Type ¶ added in v0.8.0
func (DescFields) Type() string
Type returns a string identifying the type of the value.
type Dictionary ¶
Dictionary is a collection of strings mapping to types.Values, that itself implements a types.Value. It corresponds to the Dictionary type in Roblox.
func (Dictionary) Type ¶
func (Dictionary) Type() string
Type returns a string identifying the type of the value.
type Enum ¶
type Enum struct {
// contains filtered or unexported fields
}
Enum contains a set of named values.
func (*Enum) Item ¶
Item returns the enum item corresponding to the given name, or nil if no such item exists.
func (*Enum) Pull ¶ added in v0.6.0
Pull attempts to convert a Lua value to an item of the enum. Returns nil if the value could not be converted.
A value is converted if it is a number that matches the value of an item, if it is a string that matches the name of an item, or if it is an EnumItem userdata that is an item of the enum.
type EnumItem ¶
type EnumItem struct {
// contains filtered or unexported fields
}
EnumItem represents one possible value of an enum.
type EnumItemDesc ¶
EnumItemDesc wraps a rbxdump.EnumItem to implement types.Value.
func (EnumItemDesc) Type ¶
func (EnumItemDesc) Type() string
Type returns a string identifying the type of the value.
type Enums ¶
type Enums struct {
// contains filtered or unexported fields
}
Enums is a collection of Enum values.
func (*Enums) Enum ¶
Enum returns the Enum corresponding to the given name, or nil if no such enum was found.
type FormatSelector ¶ added in v0.4.0
type FormatSelector struct { Format string Options Dictionary }
FormatSelector selects a format and provides options for configuring the format.
func (FormatSelector) String ¶ added in v0.4.0
func (f FormatSelector) String() string
String returns a string representation of the value.
func (FormatSelector) Type ¶ added in v0.4.0
func (FormatSelector) Type() string
Type returns a string identifying the type of the value.
type FunctionDesc ¶
FunctionDesc wraps a rbxdump.Function to implement types.Value.
func (FunctionDesc) Type ¶
func (FunctionDesc) Type() string
Type returns a string identifying the type of the value.
type HTTPHeaders ¶ added in v0.4.0
HTTPHeaders contains the headers of an HTTP request or response.
func (HTTPHeaders) AppendCookies ¶ added in v0.5.0
func (h HTTPHeaders) AppendCookies(c Cookies) HTTPHeaders
AppendCookie formats and adds the given cookies to the Cookie header.
func (HTTPHeaders) AppendSetCookies ¶ added in v0.5.0
func (h HTTPHeaders) AppendSetCookies(c Cookies) HTTPHeaders
AppendSetCookie formats and adds the given cookies to the Set-Cookie header.
func (HTTPHeaders) RetrieveCookies ¶ added in v0.5.0
func (h HTTPHeaders) RetrieveCookies() Cookies
RetrieveCookies parses the Cookie header.
func (HTTPHeaders) RetrieveSetCookies ¶ added in v0.5.0
func (h HTTPHeaders) RetrieveSetCookies() Cookies
RetrieveSetCookies parses the Set-Cookie header.
func (HTTPHeaders) Type ¶ added in v0.4.0
func (HTTPHeaders) Type() string
Type returns a string identifying the type of the value.
type HTTPOptions ¶ added in v0.4.0
type HTTPOptions struct { URL string Method string RequestFormat FormatSelector ResponseFormat FormatSelector Headers HTTPHeaders Cookies Cookies Body types.Value }
HTTPOptions specifies options to an HTTP request.
func (HTTPOptions) Type ¶ added in v0.4.0
func (HTTPOptions) Type() string
Type returns a string identifying the type of the value.
type HTTPResponse ¶ added in v0.4.0
type HTTPResponse struct { Success bool StatusCode int StatusMessage string Headers HTTPHeaders Cookies Cookies Body types.Value }
HTTPResponse contains the response to an HTTP request.
func (HTTPResponse) Type ¶ added in v0.4.0
func (HTTPResponse) Type() string
Type returns a string identifying the type of the value.
type Instance ¶
type Instance struct { ClassName string Reference string IsService bool // contains filtered or unexported fields }
Instance contains data describing an instance of a particular class. It corresponds to the Instance type in Roblox.
func NewDataModel ¶
func NewDataModel() *Instance
NewDataModel returns a special Instance of the DataModel class, to be used as the root of a tree of instances.
func NewInstance ¶
NewInstance returns a new Instance of the given class name. Optionally, parent sets the Parent of the instance.
func (*Instance) AddChild ¶
AddChild appends a child instance to the instance's list of children. If the child has a parent, it is first removed. The parent of the child is set to the instance. An error is returned if the instance is a descendant of the child, or if the child is the instance itself.
func (*Instance) AddChildAt ¶
AddChildAt inserts a child instance into the instance's list of children at a given position. If the child has a parent, it is first removed. The parent of the child is set to the instance. If the index is outside the bounds of the list, then it is constrained. An error is returned if the instance is a descendant of the child, or if the child is the instance itself.
func (*Instance) AttrConfig ¶ added in v0.4.0
func (inst *Instance) AttrConfig() *AttrConfig
AttrConfig returns the nearest AttrConfig for the instance. If the AttrConfig of current instance is nil, then the parent is searched, and so on, until a non-nil or blocked AttrConfig is found. Nil is returned if no Attrs are found.
func (*Instance) Clone ¶
Clone returns a copy of the instance. Each property and all descendants are copied as well. Unlike Roblox's implementation, the Archivable property is ignored.
A copied reference within the tree is resolved so that it points to the corresponding copy of the original referent. Copied references that point to an instance which isn't being copied will still point to the same instance.
func (*Instance) Copy ¶
Copy is an alias for Clone that allows Instance to implement types.PropValue.
func (*Instance) Desc ¶
Desc returns the nearest root descriptor for the instance. If the descriptor of current instance is nil, then the parent is searched, and so on, until a non-nil or blocked descriptor is found. Nil is returned if no descriptors are found.
func (*Instance) Descend ¶ added in v0.6.0
Descend returns a descendant of the instance by recursively searching for each name in succession according to FindFirstChild. Returns the instance itself if no arguments are given. Returns nil if a child could not be found.
func (*Instance) Descendants ¶
Descendants returns the descendants of the instance in a list.
func (*Instance) FindFirstAncestor ¶
FindFirstAncestor returns the nearest ancestor of the instance that matches the given name, or nil if no such instance was found.
func (*Instance) FindFirstAncestorOfClass ¶
FindFirstAncestorOfClass returns the nearest ancestor of the instance that matches the given class name, or nil if no such instance was found.
func (*Instance) FindFirstAncestorWhichIsA ¶ added in v0.4.0
FindFirstAncestorWhichIsA returns the nearest ancestor of the instance that inherits from the given class name, or nil if no such instance was found. If an instance has no descriptor, then only its ClassName is compared.
func (*Instance) FindFirstChild ¶
FindFirstChild returns the first child instance of the given name. If recurse is true, then descendants will also be searched top-down.
func (*Instance) FindFirstChildOfClass ¶
FindFirstChildOfClass returns the first child instance of the given class name. If recurse is true, then descendants will also be searched top-down.
func (*Instance) FindFirstChildWhichIsA ¶ added in v0.4.0
FindFirstChildWhichIsA returns the first child instance that inherits from the given class name. If recurse is true, then descendants will also be searched top-down. If an instance has no descriptor, then only its ClassName is compared.
func (*Instance) ForEachChild ¶ added in v0.6.0
ForEachChild iterates over each child of the instance.
If cb returns an error, iteration stops, and the error is returned.
func (*Instance) ForEachDescendant ¶ added in v0.6.0
ForEachDescendant iterates over each descendant of the instance, depth-first.
If cb returns SkipChildren, then the method moves to the next sibling of desc without visiting the children of desc.
Otherwise, if cb returns an error, iteration stops, and the error is returned.
func (*Instance) ForEachProperty ¶ added in v0.6.0
ForEachProperty iterates over each property of the instance.
The order in which properties are visited is undefined.
If cb returns an error, iteration stops, and the error is returned.
func (*Instance) Get ¶
Get returns the value of a property in the instance. The value will be nil if the property is not defined.
If property is "ClassName", then the ClassName field is returned as a types.String.
If property is "Parent", then the result of the Parent method is returned.
func (*Instance) GetFullName ¶
GetFullName returns the "full" name of the instance, which is the combined names of the instance and every ancestor, separated by a `.` character.
func (*Instance) IsA ¶ added in v0.4.0
IsA returns whether the instance's class inherits from className. If the instance has no descriptor, then only its ClassName is compared.
func (*Instance) IsAncestorOf ¶
IsAncestorOf returns whether the instance is the ancestor of another instance.
func (*Instance) IsDataModel ¶
IsDataModel returns whether the instance is a root DataModel.
func (*Instance) IsDescendantOf ¶
IsDescendantOf returns whether the instance is the descendant of another instance.
func (*Instance) Metadata ¶ added in v0.5.0
Metadata returns the metadata of a DataModel. Returns nil if the Instance is not a DataModel.
func (*Instance) Name ¶
Name returns the Name property of the instance, or an empty string if it is invalid or not defined.
func (*Instance) Parent ¶
Parent returns the parent of the instance. Returns nil if the instance has no parent.
func (*Instance) Properties ¶
Properties returns the properties of the instance as names mapped to values.
ClassName and Parent are not included.
func (*Instance) PropertyNames ¶ added in v0.7.0
PropertyNames returns a list of names of properties set on the instance.
func (*Instance) RawAttrConfig ¶ added in v0.4.0
func (inst *Instance) RawAttrConfig() (attrcfg *AttrConfig, blocked bool)
RawAttrConfig returns the AttrConfig for the instance, and whether it is blocked.
func (*Instance) RawDesc ¶
RawDesc returns the root descriptor for the instance, and whether it is blocked.
func (*Instance) RemoveAll ¶
func (inst *Instance) RemoveAll()
RemoveAll remove every child from the instance. The parent of each child is set to nil.
func (*Instance) RemoveChild ¶
RemoveChild removes a child instance from the instance's list of children. The parent of the child is set to nil. Returns the removed child.
func (*Instance) RemoveChildAt ¶
RemoveChildAt removes the child at a given position from the instance's list of children. The parent of the child is set to nil. If the index is outside the bounds of the list, then no children are removed. Returns the removed child.
func (*Instance) RemoveChildAtFast ¶
RemoveChildAtFast is like RemoveChildAt, but does not preserve the order of children.
func (*Instance) RemoveChildFast ¶
RemoveChildFast is like RemoveChild, but does not preserve the order of children.
func (*Instance) Set ¶
Set sets the value of a property in the instance. If value is nil, then the value will be deleted from the Properties map.
If property is "ClassName", then the ClassName field is set. Set panics if value does not implement types.Stringlike.
If property is "Parent", then the SetParent method is called. Set panics if value is not an *Instance or nil, or if SetParent returns an error.
func (*Instance) SetAttrConfig ¶ added in v0.4.0
func (inst *Instance) SetAttrConfig(attrcfg *AttrConfig, blocked bool)
SetAttrConfig sets attrcfg as the AttrConfig for the instance. If blocked is true, then the AttrConfig is set to nil, and AttrConfig will return nil if it reaches the instance.
func (*Instance) SetDesc ¶
SetDesc sets root as the root descriptor for the instance. If blocked is true, then the root descriptor is set to nil, and Desc will return nil if it reaches the instance.
func (*Instance) SetParent ¶
SetParent sets the parent of the instance, removing itself from the children of the old parent, and adding itself as a child of the new parent. The parent can be set to nil. An error is returned if the parent is a descendant of the instance, or if the parent is the instance itself. If the new parent is the same as the old parent, then the position of the instance in the parent's children is unchanged.
func (*Instance) SetProperties ¶ added in v0.7.0
SetProperties replaces the properties of the instance with props. Each entry in props is a property name mapped to a value. ClassName and Parent are ignored.
If replace is true, then properties in the instance that are nil in props are removed. If false, such properties are retained. If props is nil or empty, and replace is true, then all properties are removed from the instance.
func (*Instance) String ¶
String returns a string representation of the instance by returning the Name, or the ClassName if Name isn't defined.
func (*Instance) WithDescFindFirstAncestorWhichIsA ¶ added in v0.6.0
func (inst *Instance) WithDescFindFirstAncestorWhichIsA(globalDesc *RootDesc, class string) *Instance
WithDescFindFirstAncestorWhichIsA is like FindFirstAncestorWhichIsA, but includes a global descriptor.
type MemberDesc ¶ added in v0.8.0
MemberDesc wraps a rbxdump.Member to implement types.Value.
func (MemberDesc) Type ¶ added in v0.8.0
func (MemberDesc) Type() string
Type returns a string identifying the type of the value.
type NilType ¶
type NilType struct{}
NilType represents a nil value that implements types.Value.
var Nil NilType
Nil is a value of NilType.
type Objects ¶
type Objects []*Instance
Objects is a list of Instances that implements types.Value. It corresponds to the Objects type in Roblox.
type Optional ¶ added in v0.9.0
type Optional struct {
// contains filtered or unexported fields
}
Optional is a types.Value that may have some value, or none.
func (Optional) Copy ¶ added in v0.9.0
Copy returns a copy of the Optional. If the underlying value does not implement PropValue, then None is returned.
func (*Optional) Some ¶ added in v0.9.0
Some sets the option to have the given value and value's type.
type ParameterDesc ¶
ParameterDesc wraps a rbxdump.Parameter to implement types.Value.
func (ParameterDesc) Type ¶
func (ParameterDesc) Type() string
Type returns a string identifying the type of the value.
type PropertyDesc ¶
PropertyDesc wraps a rbxdump.Property to implement types.Value.
func (PropertyDesc) Type ¶
func (PropertyDesc) Type() string
Type returns a string identifying the type of the value.
type RBXAssetOptions ¶ added in v0.5.0
type RBXAssetOptions struct { AssetID int64 Cookies Cookies Format FormatSelector Body types.Value }
RBXAssetOptions specifies options to a Roblox web request.
func (RBXAssetOptions) Type ¶ added in v0.5.0
func (RBXAssetOptions) Type() string
Type returns a string identifying the type of the value.
type RootDesc ¶
RootDesc wraps a rbxdump.Root to implement types.Value.
func (*RootDesc) Class ¶ added in v0.8.0
Class returns the class descriptor from a class name. Returns nil if d is nil, or the class was not found.
func (*RootDesc) ClassIsA ¶ added in v0.8.0
ClassIsA returns whether class is a subclass of superclass. Returns false if d is nil, or if class or superclass are not valid classes.
func (*RootDesc) Enum ¶ added in v0.8.0
Enum returns the enum descriptor from an enum name. Returns nil if d is nil, or the enum was not found.
func (*RootDesc) EnumItem ¶ added in v0.8.0
EnumItem returns the enum item descriptor from an enum and item name. Returns nil if d is nil, or the enum or item was not found.
func (*RootDesc) GenerateEnumTypes ¶
func (d *RootDesc) GenerateEnumTypes()
GenerateEnumTypes sets EnumTypes to a collection of enum values generated from the root's enum descriptors.
func (*RootDesc) Member ¶
Member gets a member descriptor from a class, or any class it inherits from. Returns nil if d is nil, or if the class or member was not found.
func (*RootDesc) Of ¶ added in v0.6.0
Of returns the root descriptor of an instance. If inst is nil, r is returned.
func (*RootDesc) Property ¶
Property gets a property descriptor from a class, or any class it inherits from. Returns nil if d is nil, or if the class or member was not found.
type Symbol ¶
type Symbol struct {
Name string
}
Symbol is a unique identifier used for accessing members.
type Table ¶
Table wraps a Lua table to implement types.Value.
type Tuple ¶
Tuple is a sequence of types.Values that itself implements types.Value. It corresponds to the Tuple type in Roblox.