From ab62c8a926360a0de62750a264d88b4aaa93b2b9 Mon Sep 17 00:00:00 2001
From: Robin Gareus obj = Session:route_by_name("Audio") obj:set_name("Guitar").
-Lua automatically follows C++ class inheritance. e.g one can directly call all SessionObject and Route methods on Track object. However lua does not automatically promote objects. A Route object which just happens to be a Track needs to be explicily cast to a Track. Methods for casts are provided with each class. Note that the cast may fail and return a nil reference. +Lua automatically follows C++ class inheritance. e.g one can directly call all SessionObject and Route methods on Track object. However lua does not automatically promote objects. A Route object which just happens to be a Track needs to be explicitly cast to a Track. Methods for casts are provided with each class. Note that the cast may fail and return a nil reference.
-Likewise multiple inheritance is a non-trivial issue in lua. To avoid performance penalties involved with lookups, explicit casts are required in this case. One example is =typelink('ARDOUR:SessionObject')?> which is-a StatefulDestructible which inhertis from both Stateful and Destructible. +Likewise multiple inheritance is a non-trivial issue in Lua. To avoid performance penalties involved with lookups, explicit casts are required in this case. One example is =typelink('ARDOUR:SessionObject')?> which is-a StatefulDestructible which inherits from both Stateful and Destructible.
Object lifetimes are managed by the Session. Most Objects cannot be directly created, but one asks the Session to create or destroy them. This is mainly due to realtime constrains: @@ -882,7 +885,7 @@ you cannot simply remove a track that is currently processing audio. There are v
-Since lua functions are closures, C++ methods that pass arguments by reference cannot be used as-is. +Since Lua functions are closures, C++ methods that pass arguments by reference cannot be used as-is. All parameters passed to a C++ method which uses references are returned as Lua Table. If the C++ method also returns a value it is prefixed. Two parameters are returned: the value and a Lua Table holding the parameters.
@@ -934,12 +937,12 @@ print (rv, ref[1], ref[2])
Libardour makes extensive use of reference counted boost::shared_ptr to manage lifetimes.
-The Lua bindings provide a complete abstration of this. There are no pointers in lua.
-For example a =typelink('ARDOUR:Route')?> is a pointer in C++, but lua functions operate on it like it was a class instance.
+The Lua bindings provide a complete abstraction of this. There are no pointers in Lua.
+For example a =typelink('ARDOUR:Route')?> is a pointer in C++, but Lua functions operate on it like it was a class instance.
-shared_ptr are reference counted. Once assigned to a lua variable, the C++ object will be kept and remains valid.
-It is good practice to assign references to lua local variables or reset the variable to nil to drop the ref.
+shared_ptr are reference counted. Once assigned to a Lua variable, the C++ object will be kept and remains valid.
+It is good practice to assign references to Lua local variables or reset the variable to nil to drop the ref.
All pointer classes have a isnil () method. This is for two cases:
@@ -949,13 +952,13 @@ may not be able to find the given plugin and hence cannot create an object.
The second case if for boost::weak_ptr. As opposed to boost::shared_ptr weak-pointers are not reference counted.
The object may vanish at any time.
-If lua code calls a method on a nil object, the interpreter will raise an exception and the script will not continue.
+If Lua code calls a method on a nil object, the interpreter will raise an exception and the script will not continue.
This is not unlike a = nil a:test() which results in en error "attempt to index a nil value".
-From the lua side of things there is no distinction between weak and shared pointers. They behave identically. -Below they're inidicated in orange and have an arrow to indicate the pointer type. -Pointer Classes cannot be created in lua scripts. It always requires a call to C++ to create the Object and obtain a reference to it. +From the Lua side of things there is no distinction between weak and shared pointers. They behave identically. +Below they're indicated in orange and have an arrow to indicate the pointer type. +Pointer Classes cannot be created in Lua scripts. It always requires a call to C++ to create the Object and obtain a reference to it.
diff --git a/tools/update_luadoc.sh b/tools/update_luadoc.sh index 258e9a2341..73b281d9e0 100755 --- a/tools/update_luadoc.sh +++ b/tools/update_luadoc.sh @@ -22,7 +22,7 @@ if test -f $AMANUAL/include/class-reference.html; then php $DIR/fmt-luadoc.php -m > $AMANUAL/include/class-reference.html ls -l $AMANUAL/include/class-reference.html cd $AMANUAL/ - ./build.py + ./build.py --nopdf else php $DIR/fmt-luadoc.php > /tmp/luadoc.html ls -l /tmp/luadoc.html