[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lua_replace finding
- From: Patrick Donnelly <batrick@...>
- Date: Thu, 25 Jun 2009 00:49:41 -0600
On Thu, Jun 25, 2009 at 12:39 AM, Shmuel Zeigerman<shmuz@013net.net> wrote:
> When Lua stack has one element, doing lua_replace(L,1) removes that element.
> (I'd expect the stack to be left unchanged.)
>
> int test(lua_State*L) {
> lua_settop(L, 0);
> lua_pushnumber(L, 0);
> lua_replace(L, 1);
> printf("%d\n", lua_gettop(L)); // 0 is printed
> return 0;
> }
The manual is pretty explicit about the top element being removed from
the stack. I don't see why this should be different for this odd use
case.
--
-Patrick Donnelly
"Let all men know thee, but no man know thee thoroughly: Men freely
ford that see the shallows."
- Benjamin Franklin