[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: tinsert (was: Finding the version)
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Mon, 20 Aug 2001 21:51:49 -0300
>For a long time I advocate to make C-functions behave similar to
>Lua functions regarding argument handling (make missing args nil).
This is easy to do: If you expect k arguments on the stack, do lua_settop(k)
as the first thing in your C function. Missing arguments will become nil and
extra arguments will be "deleted".
The current design, in which C functions have freedom to decide what to do
when the number of arguments passed is not what is expected, seems to us
to be more flexible and the right one for writing libraries, even if it
sometimes may be confusing.
As we say in our meetings: C is not Lua! :-)
This is serious: in C you can do anything, and so there's no hand-holding
and you're also expected to work harder.
--lhf