/** * The Instance class is a lightweight representation of an object in a * Roblox place or model. Each instance has a class name, a name, an * optional parent, a list of children and a set of arbitrary properties. * Instances can form a tree and provide utilities for traversing that tree. */ export declare class Instance { /** * Child instances belonging to this instance. */ readonly Children: Instance[]; /** * A dictionary of properties keyed by their name. Each entry holds the * type of the property and its value. Types mirror the DataTypes found * in Roblox binary files (e.g. string, bool, int, float, Instance, etc.). */ readonly Properties: { [key: string]: { type: string; value: any; }; }; /** * A dictionary of attribute values attached to this instance. Attributes * are exposed as plain JavaScript values. This library does not * currently attempt to decode the attribute serialization format present * in .rbxm/.rbxl files; consumers may populate this dictionary manually. */ Attributes: { [key: string]: any; }; /** * Create a new Instance of the given class. The Name property * defaults to the literal string "Instance" and the Parent property * defaults to undefined. Use setProperty() to adjust these values. */ constructor(className: string); /** * Convenience factory to create a new instance. */ static new(className: string): Instance; /** * Getter for the ClassName property. */ get ClassName(): string; /** * Getter for the Name property. */ get Name(): string; /** * Getter for the Parent property. */ get Parent(): Instance | InstanceRoot | undefined; /** * Set a property on this instance. If the property already exists its * type must match the previously specified type. Certain properties * receive special treatment: when setting the Parent property the * Children arrays of the old and new parent are updated accordingly. */ setProperty(name: string, value: any, type?: string): void; /** * Retrieve the value of a property by name. If caseInsensitive is * true then a case insensitive lookup will be performed. */ getProperty(name: string, caseInsensitive?: boolean): any; /** * Return this instance's children. */ getChildren(): Instance[]; /** * Recursively walk the instance tree and return all descendants. */ getDescendants(): Instance[]; /** * Recursively find the first child of this instance with a given name. */ findFirstChild(name: string, recursive?: boolean): Instance | undefined; /** * Recursively find the first child of this instance with a given class name. */ findFirstChildOfClass(className: string, recursive?: boolean): Instance | undefined; /** * Compute the dotted path of this instance by traversing parents up to the root. */ getFullName(): string; /** * Test whether this instance defines a property with the given name. */ hasProperty(name: string, caseInsensitive?: boolean): boolean; /** * Retrieve the value of an attribute by name. */ getAttribute(name: string): any; } /** * The InstanceRoot class is simply an array of Instance objects with a few * helper methods. It acts as the top-level container returned by the * parser. The root itself is not an actual Roblox instance; it is a * convenience wrapper that exposes findFirstChild and findFirstChildOfClass * on the root container. */ export declare class InstanceRoot extends Array { getChildren(): Instance[]; getDescendants(): Instance[]; findFirstChild(name: string, recursive?: boolean): Instance | undefined; findFirstChildOfClass(className: string, recursive?: boolean): Instance | undefined; } export default Instance;