From 868ecad32ba7fb3eb763642e22ebb06938fdb359 Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Sun, 8 May 2011 22:34:40 +0200 Subject: FFI: Add ffi.errno(). --- doc/ext_ffi_api.html | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'doc') diff --git a/doc/ext_ffi_api.html b/doc/ext_ffi_api.html index b1b42878..2d69cb49 100644 --- a/doc/ext_ffi_api.html +++ b/doc/ext_ffi_api.html @@ -336,6 +336,28 @@ objects.

Utility Functions

+

err = ffi.errno()

+

+Returns the error number set by the last C function call which +indicated an error condition. +

+

+This function offers a portable and OS-independent way to get the error +number. Note that only some C functions set the error +number. And it's only significant if the function actually indicated an +error condition (e.g. with a return value of -1 or +NULL). Otherwise, it may or may not contain any previously set +value. +

+

+You're advised to call this function only when needed and as close as +possible after the return of the related C function. The +errno value is preserved across hooks, memory allocations, +invocations of the JIT compiler and other internal VM activity. The same +applies to the value returned by GetLastError() on Windows, but +you need to declare and call it yourself. +

+

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

Creates an interned Lua string from the data pointed to by -- cgit v1.2.3-55-g6feb