lua-users home
lua-l archive

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

On Mon, Jun 1, 2009 at 6:43 PM, Phoenix Sol <> wrote:
On Jun 1, 2009, at 2:35 PM, Linker <> wrote:

 Event-driven is no a good choice for lua programming.Coroutine is a better choice.

I'm no computer scientist, but I think that event loops and coroutines can be used together quite nicely.


I have been reading this post and hopping for a small example. Can someone explain if I have a C[++] thread that fires an event to Lua how it can "hook-up" in a thread safe way to the event? I would be fine with what ever work. No matter if it is coroutine or callbacks. I know the particular library I am trying to wrap uses callbacks, but the events can happen anytime. I tried to just call a registered Lua function, but I had thread safty issues because the event got fired while the main part of the script was running.