From 91069c5f7f079165a5ce30dde43dbe2334ad2e5a Mon Sep 17 00:00:00 2001 From: Leonardo de Moura Date: Fri, 2 May 2014 13:37:15 -0700 Subject: [PATCH] feat(util/list_lua): add length method to list Lua API Signed-off-by: Leonardo de Moura --- src/util/list_lua.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/util/list_lua.h b/src/util/list_lua.h index ef886107d4..99b6f3ae53 100644 --- a/src/util/list_lua.h +++ b/src/util/list_lua.h @@ -47,9 +47,11 @@ static int list_ ## T ## _cdr(lua_State * L) { \ } \ static int list_ ## T ## _eq(lua_State * L) { return push_boolean(L, to_list_ ## T(L, 1) == to_list_ ## T(L, 2)); } \ static int list_ ## T ## _is_eqp(lua_State * L) { return push_boolean(L, is_eqp(to_list_ ## T(L, 1), to_list_ ## T(L, 2))); } \ +static int list_ ## T ## _len(lua_State * L) { return push_integer(L, length(to_list_ ## T(L, 1))); } \ static const struct luaL_Reg list_ ## T ## _m[] = { \ {"__gc", list_ ## T ## _gc}, \ {"__eq", safe_function}, \ + {"__len", safe_function}, \ {"is_nil", safe_function}, \ {"empty", safe_function}, \ {"car", safe_function}, \