summaryrefslogtreecommitdiff
path: root/doc/ext_ffi_api.html
diff options
context:
space:
mode:
authorMike Pall <mike>2011-04-20 01:53:26 +0200
committerMike Pall <mike>2011-04-20 01:53:26 +0200
commit5d096dcfdef5ddb0e6dd67e155adf893df7d7809 (patch)
tree9bdbd2852738e761b1b2f0f1858eb91f22a8e638 /doc/ext_ffi_api.html
parent9ea679410c8061741a49350b3fc969365ffe5547 (diff)
downloadluajit2-5d096dcfdef5ddb0e6dd67e155adf893df7d7809.tar.gz
FFI: Add ffi.istype() function.
Diffstat (limited to 'doc/ext_ffi_api.html')
-rw-r--r--doc/ext_ffi_api.html18
1 files changed, 18 insertions, 0 deletions
diff --git a/doc/ext_ffi_api.html b/doc/ext_ffi_api.html
index 2b6d1d86..b1b42878 100644
--- a/doc/ext_ffi_api.html
+++ b/doc/ext_ffi_api.html
@@ -316,6 +316,24 @@ of <tt>ct</tt>, which must be a <tt>struct</tt>. Additionally returns
the position and the field size (in bits) for bit fields.
</p>
+<h3 id="ffi_istype"><tt>status = ffi.istype(ct, obj)</tt></h3>
+<p>
+Returns <tt>true</tt> if <tt>obj</tt> has the C&nbsp;type given by
+<tt>ct</tt>. Returns <tt>false</tt> otherwise.
+</p>
+<p>
+C&nbsp;type qualifiers (<tt>const</tt> etc.) are ignored. Pointers are
+checked with the standard pointer compatibility rules, but without any
+special treatment for <tt>void&nbsp;*</tt>. If <tt>ct</tt> specifies a
+<tt>struct</tt>/<tt>union</tt>, then a pointer to this type is accepted,
+too. Otherwise the types must match exactly.
+</p>
+<p>
+Note: this function accepts all kinds of Lua objects for the
+<tt>obj</tt> argument, but always returns <tt>false</tt> for non-cdata
+objects.
+</p>
+
<h2 id="util">Utility Functions</h2>
<h3 id="ffi_string"><tt>str = ffi.string(ptr [,len])</tt></h3>