[Tarantool-patches] [PATCH] net.box: allow to store user-defined fields in future object

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Thu Aug 12 21:13:34 MSK 2021


On 12.08.2021 21:02, Vladislav Shpilevoy via Tarantool-patches wrote:
> Hi! Thanks for the patch!
> 
> See 3 comments below.
> 
>> diff --git a/src/box/lua/net_box.c b/src/box/lua/net_box.c
>> index 06e574cdf746..162ff6c82fb0 100644
>> --- a/src/box/lua/net_box.c
>> +++ b/src/box/lua/net_box.c
> <...>
> 
>> +
>> +static int
>> +luaT_netbox_request_newindex(struct lua_State *L)
>> +{
>> +	struct netbox_request *request = luaT_check_netbox_request(L, 1);
>> +	struct mh_strnptr_t *h = request->index;
>> +	size_t field_name_len;
>> +	const char *field_name = lua_tolstring(L, 2, &field_name_len);
>> +	if (field_name == NULL)
>> +		return luaL_error(L, "invalid index");
>> +	int field_value_ref = luaL_ref(L, LUA_REGISTRYINDEX);
>> +	if (field_value_ref == LUA_REFNIL) {
>> +		/* The field is set to nil. Delete it from the index. */
> 
> 1. But it is not deleted. It is just ignored, which is fine, but
> the comment is wrong then.

Sorry, nevermind. I looked at h == NULL below and misinterpreted it
in a hurry.

>> +		if (h == NULL)
>> +			return 0;


More information about the Tarantool-patches mailing list