My issue is passing arguments to a lua function via the aerospike-c-client. I have to do a multi where query and have the first where clause defined by:
as_query query;
as_query_init(&query, asNamespace, asSet);
as_query_where_inita(&query, 1);
as_query_where(&query, binName, as_string_equals(where_val));
Now the issue is passing the second where value to lua so lua can do more filtering
as_arraylist arglist;
as_arraylist_inita(&arglist, 1);
as_arraylist_append_string(&arglist, "Id");
as_arraylist_append(&arglist, (as_val *) where_val2);
as_query_apply(&query, UDF_MODULE, lua_function, &arglist);
if (aerospike_query_foreach(&as, &err, NULL, &query, query_cb_map, NULL) != AEROSPIKE_OK { ...
I have a lua function defined as:
function luaFunction(stream, id)
local function filterId(record)
if record.Id == id then
return record
end
end
return stream : filter(filterId) : map(mapUser)
end
Unfortunately the lua function doesn’t receive the id field. If I do a static id for testing it works as it should. For example:
if record.Id == "1234" then
return record
end
How can I get the lua function take the correct argments from the client-c-library?