[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: reallycheckint(L,index)
- From: Tim Hill <drtimhill@...>
- Date: Tue, 28 May 2013 23:59:41 -0700
I'm trying to figure out what you're checking (it's late here!) .. a Lua number that has no fractional part (with all the issues that can cause) or a Lua number that can be stored within a C "int" without overflow?
pi==3 would make life so much easier …
On May 28, 2013, at 11:22 PM, Dirk Laurie <firstname.lastname@example.org> wrote:
> I can't believe the following is the best way of not happily
> accepting pi=3 etc. Too many calls to genuine functions as
> distinct from macros.
> #define reallycheckint(L,index) (\
> luaL_argcheck(L,lua_compare(L,index,-1,LUA_OPEQ),index,"expected integer"),\
> lua_pop(L,1), lua_tointeger(L,index) )
> But every time I try to improve on it I need to store something
> in a C variable.