summaryrefslogtreecommitdiff
path: root/Lua API.html
diff options
context:
space:
mode:
Diffstat (limited to 'Lua API.html')
-rw-r--r--Lua API.html14
1 files changed, 10 insertions, 4 deletions
diff --git a/Lua API.html b/Lua API.html
index 0f1ecc3b..c4ab9c8c 100644
--- a/Lua API.html
+++ b/Lua API.html
@@ -1596,8 +1596,8 @@ Using <tt class="docutils literal">timeout_active(id,nil)</tt> cancels the timer
</ul>
<div class="section" id="event-type">
<h3><a class="toc-backref" href="#id29">Event type</a></h3>
-<p>An event is just a lua table with a predefined metatable that
-contains a __call metamethod. When it is invoked, it loops
+<p>An event is a native object transparently wrapping a lua table,
+and implementing a __call metamethod. When it is invoked, it loops
through the table with next and calls all contained values.
This is intended as an extensible way to add listeners.</p>
<p>This type itself is available in any context, but only the
@@ -1608,9 +1608,15 @@ core context has the actual events defined by C++ code.</p>
<p>Creates a new instance of an event.</p>
</li>
<li><p class="first"><tt class="docutils literal">event[key] = function</tt></p>
-<p>Sets the function as one of the listeners.</p>
+<p>Sets the function as one of the listeners. Assign <em>nil</em> to remove it.</p>
<p><strong>NOTE</strong>: The <tt class="docutils literal">df.NULL</tt> key is reserved for the use by
-the C++ owner of the event, and has some special semantics.</p>
+the C++ owner of the event; it is an error to try setting it.</p>
+</li>
+<li><p class="first"><tt class="docutils literal">#event</tt></p>
+<p>Returns the number of non-nil listeners.</p>
+</li>
+<li><p class="first"><tt class="docutils literal">pairs(event)</tt></p>
+<p>Iterates over all listeners in the table.</p>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">event(args...)</span></tt></p>
<p>Invokes all listeners contained in the event in an arbitrary