From 5d096dcfdef5ddb0e6dd67e155adf893df7d7809 Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Wed, 20 Apr 2011 01:53:26 +0200 Subject: FFI: Add ffi.istype() function. --- doc/ext_ffi_api.html | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'doc/ext_ffi_api.html') 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 ct, which must be a struct. Additionally returns the position and the field size (in bits) for bit fields.

+

status = ffi.istype(ct, obj)

+

+Returns true if obj has the C type given by +ct. Returns false otherwise. +

+

+C type qualifiers (const etc.) are ignored. Pointers are +checked with the standard pointer compatibility rules, but without any +special treatment for void *. If ct specifies a +struct/union, then a pointer to this type is accepted, +too. Otherwise the types must match exactly. +

+

+Note: this function accepts all kinds of Lua objects for the +obj argument, but always returns false for non-cdata +objects. +

+

Utility Functions

str = ffi.string(ptr [,len])

-- cgit v1.2.3-55-g6feb