lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Feb 19, 2008 3:50 AM, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
> We have already implemented several small changes:

Could you consider changing sort to allow any callable object:

   --- old/ltablib.c  Fri Dec 28 07:32:24 2007
   +++ new/ltablib.c  Tue Feb 19 11:32:55 2008
   @@ -248,8 +248,6 @@
    static int sort (lua_State *L) {
      int n = aux_getn(L, 1);
      luaL_checkstack(L, 40, "");  /* assume array is smaller than 2^40 */
   -  if (!lua_isnoneornil(L, 2))  /* is there a 2nd argument? */
   -    luaL_checktype(L, 2, LUA_TFUNCTION);
      lua_settop(L, 2);  /* make sure there is two arguments */
      auxsort(L, 1, n);
      return 0;

This is consistent with pcall, xpcall, for, package.loader[n], etc.,
all of which accept any callable object.

Discussed here: http://lua-users.org/lists/lua-l/2008-02/msg00405.html

Cheers,
Eric