From 71d00a56dbab6c29c0346093dbe530d7b7608be4 Mon Sep 17 00:00:00 2001
From: Mike Pall
Date: Mon, 14 Nov 2011 14:15:57 +0100
Subject: FFI: Add callback support (for x86/x64).
---
doc/ext_ffi_api.html | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
(limited to 'doc/ext_ffi_api.html')
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 ctype.
ct — A C type specification which can be used for
most of the API functions. Either a cdecl, a ctype or a
cdata serving as a template type.
+cb — A callback object. This is a C data object
+holding a special function pointer. Calling this function from
+C code runs an associated Lua function.
VLA — A variable-length array is declared with a
? instead of the number of elements, e.g. "int[?]".
The number of elements (nelem) must be given when it's
@@ -473,6 +476,31 @@ Contains the target architecture name. Same contents as
jit.arch.
+Methods for Callbacks
+
+The C types for callbacks
+have some extra methods:
+
+
+cb:free()
+
+Free the resources associated with a callback. The associated Lua
+function is unanchored and may be garbage collected. The callback
+function pointer is no longer valid and must not be called anymore
+(it may be reused by a subsequently created callback).
+
+
+cb:set(func)
+
+Associate a new Lua function with a callback. The C type of the
+callback and the callback function pointer are unchanged.
+
+
+This method is useful to dynamically switch the receiver of callbacks
+without creating a new callback each time and registering it again (e.g.
+with a GUI library).
+
+
Extended Standard Library Functions
The following standard library functions have been extended to work
--
cgit v1.2.3-55-g6feb