[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Acceptable indicies
- From: Sean Conner <sean@...>
- Date: Wed, 31 Aug 2011 12:25:16 -0400
It was thus said that the Great Sean Conner once stated:
> It was thus said that the Great liam mail once stated:
> >
> > luaL_optint(L,2,0) on a stack which has one entry would therefore be
> > an error and not a valid request using the function you posted
> > previously with the incorrect name 'mylua_isacceptable'
>
> The stack is always going to be at least 20 entries.
One further test. This time, going by what Lua 5.1.4 *does* and not by
what the documentation *says*.
static int atest(lua_State *L)
{
int v1;
int v2;
int v3;
v1 = luaL_optint(L,1,-10);
v2 = luaL_optint(L,2,-50);
v3 = luaL_optint(L,300,-60);
printf("VALUE: %d %d %d\n",v1,v2,v3);
return 0;
}
A stack index of 300 is way out of range and thus, what does luaL_optint()
return? Well, let's run it:
[spc]lucy:~/source/lua/C>lua
Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio
> require "atest"
> atest()
VALUE: -10 -50 -60
>
Hmmm ... Roberto, can we expect this behavior, or is this a detail of the
implementaion?
-spc
- References:
- Re: Acceptable indicies, Robert Raschke
- Re: Acceptable indicies, oliver
- Re: Acceptable indicies, Josh Simmons
- Re: Acceptable indicies, oliver
- Re: Acceptable indicies, Josh Simmons
- Re: Acceptable indicies, oliver
- Re: Acceptable indicies, Sean Conner
- Re: Acceptable indicies, Sean Conner
- Re: Acceptable indicies, liam mail
- Re: Acceptable indicies, Sean Conner