lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> > Also, does lua_endblock() flush the c2lua stack?  I think it 
> does, I just
> > want to make sure.
> 
> Yes, it does. (We are not sure whether this is a bug or a feature. Maybe
> we will change that...)

Speaking of which, and since explicit use of blocks are the way to go,
I was wondering how to use those in C callbacks that are used by Lua code;
if I register:

void hook_lua_getstuff()
{
  lua_beginblock();
  lua_pushnumber(stuff);
  lua_endblock();
}

a question comes to mind:
- do I use blocks (the code in the function can get large and use a whole
  pile of Lua calls)
- if I use them, since lua_endblock empties the stack, should I put it
  before the lua_pushnumber call (or any call that pushes, but could
  call Lua to do so) ?

What is the Right Thing to do in this case ?

-- 
Lyrian