Arglist to a lua function

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?

instead of filterSegment, do you mean to have filterId?

See: https://github.com/aerospike/query-with-filters/blob/master/udf/profile.lua

Sorry just a simple typo.

And I did see that, that is what I based my code off of. The problem is that the c code that is calling it does not give it the id field properly (Or in the case of that example the password). I am having issues on how (on the c side) to give the string to lua.

This question could also be tied into my other post

Tying this question to the jaylucas’ other post …