How do I create a C function accepting multiple arguments in lua?
snippet in lua

How do I create a C function accepting multiple arguments in lua?

user5201

int test(lua_State *l)
{
  int result = 0;
  int nargs = lua_gettop(l);
  for(int i=1; i<=nargs; ++i)
  {
    result += lua_tointeger(l, i);;
  }

  lua_pushnumber(l, result);
  return 1;
}