renoise.Document.DocumentNode

A document node is a sub component in a document which contains other documents or observables.


Functions

__init(self)

Base constructor, only necessary to be called in your custom class constructor, when inheriting from renoise.Document.DocumentNode.

has_property(self, property_name : string)

->boolean

Check if the given property exists.

property(self, property_name : string)

->DocumentMember?

Access a property by name. Returns the property, or nil when there is no such property.

add_property(self, name : string, value : renoise.Document.DocumentNode)

->renoise.Document.DocumentNode

Add a new property. Name must be unique: overwriting already existing properties with the same name is not allowed and will fire an error. If you want to replace a property, remove it first, then add it again.

add_properties(self, properties : ObservableProperties)

Add a batch of properties in one go, similar to renoise.Document.create.

remove_property(self, value : DocumentMember)

Remove a previously added property. Property must exist.

In order to remove a value by it's key, use my_document:remove_property(my_document["some_member"])

save_as(self, file_name : string)

->success : boolean, error : string?

Save the whole document tree to an XML file. Overwrites all contents of the file when it already exists.

load_from(self, file_name : string)

->success : boolean, error : string?

Load the document tree from an XML file. This will NOT create new properties, except for list items, but will only assign existing property values in the document node with existing property values from the XML. This means: nodes that only exist in the XML will silently be ignored. Nodes that only exist in the document, will not be altered in any way. The loaded document's type must match the document type that saved the XML data. A document's type is specified in the renoise.Document.create() function as "model_name". For classes which inherit from renoise.Document.DocumentNode it's the class name.

to_string(self)

->string

Serialize the whole document tree to a XML string.

from_string(self, string : string)

->success : boolean, error : string?

Parse document tree from the given string data. See renoise.Document.DocumentNode:load_from for details about how properties are parsed and errors are handled.


Local Aliases

DocumentMember

renoise.Document.DocumentList | renoise.Document.DocumentNode | renoise.Document.Observable | renoise.Document.ObservableList

Track changes to document properties or general states by attaching listener functions to it.

ListElementAdded

{ index : integer, type : "insert" }

ListElementChange

ListElementAdded | ListElementRemoved | ListElementsSwapped

ListElementRemoved

{ index : integer, type : "removed" }

ListElementsSwapped

{ index1 : integer, index2 : integer, type : "swapped" }

ListNotifierFunction

(change : ListElementChange)

ListNotifierMemberContext

table | userdata

NotifierFunction

fun()

NotifierMemberContext

table | userdata

ObservableProperties

table<string, ObservableTypes | renoise.Document.DocumentList | renoise.Document.DocumentNode>

ObservableTypes

boolean | string | number | boolean[] | number[] | string[]