lua-users home
lua-l archive

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


Am 16.12.2013 02:04 schröbte Sven Olsen:

The argument tree approach can also be expanded to handle nil argument or
nil return values; though doing so requires a small C-api function.

   static int count_args(lua_State * L) {
     lua_pushnumber(L,lua_gettop(L));
     return 1;
   }

This is pretty much what `select( '#', ... )` does[1] ...

  [1]: http://www.lua.org/source/5.2/lbaselib.c.html#luaB_select


-Sven


Philipp