summaryrefslogtreecommitdiff
path: root/doc/ext_ffi_api.html
diff options
context:
space:
mode:
Diffstat (limited to 'doc/ext_ffi_api.html')
-rw-r--r--doc/ext_ffi_api.html28
1 files changed, 28 insertions, 0 deletions
diff --git a/doc/ext_ffi_api.html b/doc/ext_ffi_api.html
index e865a5f7..222c580e 100644
--- a/doc/ext_ffi_api.html
+++ b/doc/ext_ffi_api.html
@@ -78,6 +78,9 @@ corresponding <b>ctype</b>.</li>
78<li><b>ct</b> &mdash; A C&nbsp;type specification which can be used for 78<li><b>ct</b> &mdash; A C&nbsp;type specification which can be used for
79most of the API functions. Either a <b>cdecl</b>, a <b>ctype</b> or a 79most of the API functions. Either a <b>cdecl</b>, a <b>ctype</b> or a
80<b>cdata</b> serving as a template type.</li> 80<b>cdata</b> serving as a template type.</li>
81<li><b>cb</b> &mdash; A callback object. This is a C&nbsp;data object
82holding a special function pointer. Calling this function from
83C&nbsp;code runs an associated Lua function.</li>
81<li><b>VLA</b> &mdash; A variable-length array is declared with a 84<li><b>VLA</b> &mdash; A variable-length array is declared with a
82<tt>?</tt> instead of the number of elements, e.g. <tt>"int[?]"</tt>. 85<tt>?</tt> instead of the number of elements, e.g. <tt>"int[?]"</tt>.
83The number of elements (<tt>nelem</tt>) must be given when it's 86The number of elements (<tt>nelem</tt>) must be given when it's
@@ -473,6 +476,31 @@ Contains the target architecture name. Same contents as
473<a href="ext_jit.html#jit_arch"><tt>jit.arch</tt></a>. 476<a href="ext_jit.html#jit_arch"><tt>jit.arch</tt></a>.
474</p> 477</p>
475 478
479<h2 id="callback">Methods for Callbacks</h2>
480<p>
481The C&nbsp;types for <a href="ext_ffi_semantics.html#callback">callbacks</a>
482have some extra methods:
483</p>
484
485<h3 id="callback_free"><tt>cb:free()</tt></h3>
486<p>
487Free the resources associated with a callback. The associated Lua
488function is unanchored and may be garbage collected. The callback
489function pointer is no longer valid and must not be called anymore
490(it may be reused by a subsequently created callback).
491</p>
492
493<h3 id="callback_set"><tt>cb:set(func)</tt></h3>
494<p>
495Associate a new Lua function with a callback. The C&nbsp;type of the
496callback and the callback function pointer are unchanged.
497</p>
498<p>
499This method is useful to dynamically switch the receiver of callbacks
500without creating a new callback each time and registering it again (e.g.
501with a GUI library).
502</p>
503
476<h2 id="extended">Extended Standard Library Functions</h2> 504<h2 id="extended">Extended Standard Library Functions</h2>
477<p> 505<p>
478The following standard library functions have been extended to work 506The following standard library functions have been extended to work