lua-users home
lua-l archive

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


On Wed, Sep 14, 2005 at 12:52:53PM -0400, Lucas Ackerman wrote:

> Could this behavior be externalized?  I can only imagine that any 
> reasonable coder would define
> 
> function count(...)	return select("#", ...)	end

It's easy enough to write a C function to do this:

  int count( lua_State* L )
  {
    lua_pushnumber(L, (lua_Number) lua_gettop(L));
    return 1;
  }

But I'm not why we have a separate function when adding just a little
more syntactic sugar to the "..." syntax would do the job:

  #...

It would eliminate a function call for something (I assume) the VM
inherently knows.

Cheers!

-- 
Shannon Stewman         | Let us walk through the waning night,
Caught in a whirlpool,  | As dawn-rays tickle our toes, the dew soothes
A quartering act:       | Our blistered soles, and damp bones stir
Solitude or society?    | As crimson cracks under the blue-grey sky.