lua-users home
lua-l archive

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

On 4-Jun-05, at 1:55 PM, Andreas Falkenhahn wrote:


I noticed that the line that actually causes the crash is


which is a macro that calls luaC_collectgarbage() from time
to time. If I comment that line out, it does not crash any more.
But that does not really help me.

If it's not allowed to call lua_pushstring or lua_newtable etc.
during the parser is active, is there any other way to store data
in the registry during script parsing?

I assume this is Lua 5.0.2. I don't believe it is possible to do anything which might trigger garbage collection during parsing, which is why ChunkReaders are not able to actually use the Lua state.

As I understand it, the Lua 5.1 parser is gc-safe, if that's any help.

What I've done in order to get around problems like this (in ChunkReaders, anyway) is create a completely separate Lua state, and use that. Of course, in your case you would have to copy information back from the scratch state; I guess it would depend on how much information it was.