diff options
Diffstat (limited to 'aconf/model/node.lua')
-rw-r--r-- | aconf/model/node.lua | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/aconf/model/node.lua b/aconf/model/node.lua index a9854ce..c1d53e9 100644 --- a/aconf/model/node.lua +++ b/aconf/model/node.lua @@ -3,6 +3,7 @@ Copyright (c) 2012-2015 Kaarle Ritvanen See LICENSE file for license details --]] +--- @module aconf.model local M = {} local err = require('aconf.error') @@ -62,6 +63,16 @@ function M.BoundMember:init(parent, name, field) end +--- non-leaf object. An instance of this class represents +-- a non-leaf object in the data model, in the context of a specific +-- transaction. These instances appear as Lua tables, such that their +-- children may be read and written by using their relative path name +-- as the key. If the child is of complex type, it is possible to +-- assign a structure of Lua tables as the value. This results in +-- replacing the entire subtree with the provided sturcture. Providing +-- a string in lieu of a complex value is handled by interpreting the +-- string as a path and copying the subtree it refers to. +-- @klass node.TreeNode M.TreeNode = class() local function equal_tns(tn1, tn2) @@ -362,6 +373,12 @@ function M.Collection:init(context, params) end +--- list object, inherits @{node.TreeNode}. An instance of this class +-- represents a list object in the data model, in the context of a +-- specific transaction. A list is an ordered collection of +-- members. The path of a list member is that of the list augmented by +-- the index of the member. +-- @klass node.List M.List = class(M.Collection) local function _ipairs(mt, i) @@ -430,6 +447,13 @@ function M.List:init(context, params) end end + --- inserts a member to a list or set + -- @function node.insert + -- @tparam node.List list list or set + -- @param v value to be inserted + -- @tparam ?int i index. By default, the element is inserted at the + -- end of the list. This parameter is not applicable when inserting + -- to a @{node.Set} instance. function mt.insert(v, i) assert(v ~= nil) |