lua-users home
lua-l archive

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


On Tuesday 02, esmil@mailme.dk wrote:
> This is all very good and works fine except for one situation: Say a
> thread is yielded while waiting for data, but in the meantime the
> connection is closed or some other error happens and I want to
> immediately stop execution of the thread and clean up the data
> associated with it. The problem is that now I can't get to the data I
> pushed to the stack before starting it, so what I really need is some
> way to resume the thread, but throw an error immediately. I've been
> looking through the manual several times now, but I can't figure out
> how to do that. Am I just blind or is there a good reason this isn't
> possible?

You should be able to just throw an error on the yielded thread without 
resuming it by calling 'lua_error' or 'luaL_error' on the 'lua_State'

http://www.lua.org/manual/5.1/manual.html#lua_error
http://www.lua.org/manual/5.1/manual.html#luaL_error

-- 
Robert G. Jakabosky