From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp54.i.mail.ru (smtp54.i.mail.ru [217.69.128.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 2C490446441 for ; Thu, 24 Sep 2020 20:01:04 +0300 (MSK) From: Timur Safin Date: Thu, 24 Sep 2020 20:00:20 +0300 Message-Id: <7eaf13e0ac86f3c9afe521d82d2dc907479b3ffe.1600955781.git.tsafin@tarantool.org> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH 2.X 7/7] module api: luaL_cdata_iscallable List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: v.shpilevoy@tarantool.org, alexander.turenko@tarantool.org Cc: tarantool-patches@dev.tarantool.org In addition to `luaL_iscallable` we need `luaL_cdata_iscallable` because code which was calling it directly had to be copied to merger side Part of #5273 --- src/exports.h | 1 + src/lua/utils.c | 2 +- src/lua/utils.h | 6 ++++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/exports.h b/src/exports.h index 08c7ac53f..943ad69fa 100644 --- a/src/exports.h +++ b/src/exports.h @@ -345,6 +345,7 @@ EXPORT(luaL_addvalue) EXPORT(luaL_argerror) EXPORT(luaL_buffinit) EXPORT(luaL_callmeta) +EXPORT(luaL_cdata_iscallable) EXPORT(luaL_cdef) EXPORT(luaL_checkany) EXPORT(luaL_checkcdata) diff --git a/src/lua/utils.c b/src/lua/utils.c index 40078b5df..bf9f46cb7 100644 --- a/src/lua/utils.c +++ b/src/lua/utils.c @@ -1063,7 +1063,7 @@ luaT_tolstring(lua_State *L, int idx, size_t *len) } /* Based on ffi_meta___call() from luajit/src/lib_ffi.c. */ -static int +int luaL_cdata_iscallable(lua_State *L, int idx) { /* Calculate absolute value in the stack. */ diff --git a/src/lua/utils.h b/src/lua/utils.h index 6b10d2755..69ff4de86 100644 --- a/src/lua/utils.h +++ b/src/lua/utils.h @@ -541,6 +541,12 @@ luaT_tolstring(lua_State *L, int idx, size_t *ssize); LUA_API int luaL_iscallable(lua_State *L, int idx); +/** + * Check whether a Lua object is a cdata metatype with a __call field. + * + */ +LUA_API int +luaL_cdata_iscallable(lua_State *L, int idx); /** * @brief Creates a new Lua coroutine in a protected frame. If -- 2.20.1