[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: very simple question about Lua C Function args check
- From: Drake Wilson <drake@...>
- Date: Sat, 27 Nov 2010 14:26:46 -0700
Quoth Francesco Abbate <francesco.bbt@gmail.com>, on 2010-11-27 21:49:11 +0100:
> So, if I know that the stack was not alterated I can omit to use both
> lua_settop and lua_gettop and just using lauL_optint & co like Julien
> is suggesting ?
>
> If I understood correctly, when the function is called I can assume
> that all the acceptable indexes beyond the top contain either none or
> nil so I can safely access them and test their values. I just need to
> make sure that I didn't push any new values on the stack by myself.
Yes, if you unbox all the arguments into C values at the beginning and
they fit into the types conveniently handled by opt* then that's
likely the way to go.
---> Drake Wilson