lua-users home
lua-l archive

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


frank.maltman@googlemail.com wrote:
> I have the following code:
> 
> (snip)
> 
> When I load this with lua_load() and then do lua_pcall() on it,
> there's nothing left on the stack and no error.
> 
> How do I access that anonymous table from the C api?
It should be on top of the stack; if it's not there, something else has
gone wrong. If lua_pcall is succeeding, all I can think of offhand is
that you're calling it with nresults equal to 0, eg,
    lua_pcall(L, 0 /* nargs */, 0 /* nresults */, 0 /* handler */);
Which will discard all return values. Try calling it with 1 or
LUA_MULTRET instead:
    lua_pcall(L, 0, 1, 0);
And see the reference manual for more details.
If the call is succeeding and you're calling it with a >0 nresults and
it's still not putting anything on stack, I can't think of anything.
	Ben Kelly