lua-users home
lua-l archive

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


On Sun, Dec 7, 2008 at 12:32 AM, Florian Weimer <fw@deneb.enyo.de> wrote:
>> When C is called from lua, it must use the L it was passed. If C calls
>> back into lua, after lua returns to it, it must use the L it was
>> originally passed. Still. Even if lua had called back into C. This may
>> not be easy to arrange, and until coroutines are used creatively, bugs
>> may never be seen.
>>
>> What was the question?
>
> I wonder if there's a canonical way to avoid these problems, perhaps
> involving lua_newthread.

I've never seen any, and more threads are likely to make more of a problem.

Just make sure a function F called by lua always uses the L it was
passed by Lua, it is always valid (until F returns).

sqlite3 should probably be calling init_callbacks() every time before
calling a callback, since it allows callbacks to call back to its
userdata. I don't know any SQL, though, so I won't try :-). Have you
reported the bug?

Sam