From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp15.mail.ru (smtp15.mail.ru [94.100.176.133]) (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 D77BF44643A for ; Fri, 25 Sep 2020 00:01:15 +0300 (MSK) From: Timur Safin Date: Fri, 25 Sep 2020 00:00:35 +0300 Message-Id: In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH 1.10 3/9] module api: luaT_newthread 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 Exporting `luaT_newthread` as it's necessary for external merger Part of #5273 --- src/lua/utils.h | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/lua/utils.h b/src/lua/utils.h index fe6728986..363d5e908 100644 --- a/src/lua/utils.h +++ b/src/lua/utils.h @@ -505,6 +505,29 @@ luaT_state(void); LUA_API const char * luaT_tolstring(lua_State *L, int idx, size_t *ssize); +/** + * Check whether a Lua object is a function or has + * metatable/metatype with a __call field. + * + * Note: It does not check type of __call metatable/metatype + * field. + */ +LUA_API int +luaL_iscallable(lua_State *L, int idx); + + +/** + * @brief Creates a new Lua coroutine in a protected frame. If + * call underneath succeeds, the created Lua state + * is on the top of the guest stack and a pointer to this state is + * returned. Otherwise LUA_ERRMEM error is handled and the result + * is NULL. + * @param L is a Lua state + * @sa + */ +struct lua_State * +luaT_newthread(struct lua_State *L); + /** \endcond public */ void @@ -605,18 +628,6 @@ int luaL_checkconstchar(struct lua_State *L, int idx, const char **res, uint32_t *cdata_type_p); -/** - * @brief Creates a new Lua coroutine in a protected frame. If - * call underneath succeeds, the created Lua state - * is on the top of the guest stack and a pointer to this state is - * returned. Otherwise LUA_ERRMEM error is handled and the result - * is NULL. - * @param L is a Lua state - * @sa - */ -struct lua_State * -luaT_newthread(struct lua_State *L); - int tarantool_lua_utils_init(struct lua_State *L); -- 2.20.1