From 8b71ab108053c12bc2de9c1de0f786387a2b75e5 Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Wed, 20 Jun 2012 18:24:49 +0200 Subject: FFI: Check for __new metamethod when calling a constructor. --- doc/ext_ffi_semantics.html | 12 +++++++++--- src/lib_ffi.c | 41 ++++++++++++++++++++++------------------- src/lj_crecord.c | 44 +++++++++++++++++++++++++------------------- src/lj_obj.h | 8 +++++++- 4 files changed, 63 insertions(+), 42 deletions(-) diff --git a/doc/ext_ffi_semantics.html b/doc/ext_ffi_semantics.html index 4b498fbe..d0613aed 100644 --- a/doc/ext_ffi_semantics.html +++ b/doc/ext_ffi_semantics.html @@ -599,8 +599,9 @@ C type pointed to by the reference.

The pre-defined operations are always tried first before deferring to a -metamethod or index table (if any) for the corresponding ctype. An error -is raised if the metamethod lookup or index table lookup fails. +metamethod or index table (if any) for the corresponding ctype (except +for __new). An error is raised if the metamethod lookup or +index table lookup fails.

Indexing a cdata object

@@ -669,7 +670,12 @@ to foo.c.