lua-users home
lua-l archive

RE: lua_pcall

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


> So long as you don't pop the function off or do an "insert", etc.,
> the value of err_func will be fine. 
Well, what I'm trying to figure out is the relationship between 
setting the err_func and any existing values on the stack.
I have a generic function I call that wraps lua_pcall, let's call it 
my_pcall. I push the parameters I want to call, e.g. two numbers, and 
the name of the function:
lua_getglobal( l, "some_func" );
lua_pushstring( l, "a" );
lua_pushstring( l, "b" );
my_pcall();
But if my_pcall does stack manipulation in order to retrieve the 
err_func, my values are gonna be out of whack from what the called 
function is expecting? i.e. if I then do:
lua_pushliteral( .. );
lua_rawget( .. );
The stack is no longer structured correctly for my call since the 
push_literal/rawget combination have now pushed something onto the top 
of the stack that I'm not allowed to remove. At least, I think that's 
what's happening.
Sorry for being dense on this.
Brian

AltStyle によって変換されたページ (->オリジナル) /