lua-users home
lua-l archive

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

On 9 Apr 2013, at 06:45, Satz Klauer wrote:

> OK, but that means a callback, where a function in my LUA-script is
> called asynchronously, isn't possible!?

Not necessarily

1) If the callback has no upvalues, use string.dump and run it in a different state
2) Add a c function in your script that is called regularly that unlocks your mutex and sleeps for a while (this way the other threads can use the state while your script is in that c function). Use a condition var to way up the callbacks
3) Instead of using callbacks to inject the information, regularly poll for the information from the script.

I tend to use a combination of 1 and 3.