Re: Lua stack state during 'lua_load'

Roberto Ierusalimschy <[email protected]>
Newsgroups gmane.comp.lang.lua.general
Message-ID <[email protected]>
> Reference manual for 'lua_load' says:
> > The function lua_dump fully preserves the Lua stack
> > through the calls to the writer function,
> > except that it may push some values for internal use
> > before the first call,
> > and it restores the stack size to its original size
> > after the last call.

(You are talking about lua_load, but quoted the documentation about
lua_dump. Never mind...)

> How about the 'kcache' table that is pushed each time
> new function is being parsed (see 'open_func' in lparser.c).
> Now the reader cannot assume that the Lua stack is fully preserved
> as it might of pushed a new 'kcache' table.
> 
> [...]

Many thanks for the feedback. Actually, the problem is worse than you
mentioned. lua_load starts by reading a first byte to detect whether
the chunk is text or binary, so everything it pushes (including the
scanner table) is being pushed after the first call to the reader function.

-- Roberto

-- 
You received this message because you are subscribed to the Google Groups "lua-l" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/lua-l/20260420164205.GA365130%40arraial.inf.puc-rio.br.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.