lua-users home
lua-l archive

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


Lavergne Thomas wrote:
> No the lua free the lua_state only when you call lua_close on it or when
> the app finish, so you can use it for all evaluation you want :

Thanks!  In that case I was confused by a mixture of mild
documentation ambiguity and the fact that I just can't seem to
lua_pcall() the same chunk twice, which should work if I understand
you correctly, but does not.

This is what I do (lua 5.00alpha):

L = lua_open();       // succeeds
register_apis(L);     // succeeds
lua_load (L, ...);    // succeeds
lua_pcall(L, 0, LUA_MULTRET, 0); // succeeds, works, returns 0
lua_pcall(L, 0, LUA_MULTRET, 0); // does nothing, returns LUA_ERRRUN
lua_pcall(L, 0, LUA_MULTRET, 0); // does nothing, returns LUA_ERRRUN
lua_pcall(L, 0, LUA_MULTRET, 0); // does nothing, returns LUA_ERRRUN

I believe that ALL of those lua_pcall()s should work -- right?

The script is simply fib.lua from the test directory of
the lua5 distribution.  If I cut the script down to just
a single print("HELLO!") then the problem still persists.

..
> The lua coroutine don't use any thread lib, the manual would say that
> you could have a real multi thread system in lua if you provide an
> external multi thread lib and you can use an independent implementation
> in lua of corountine, so if you don't have lib is like if you have only
> one thread and you run coroutine on it.

That's good news.  Thank you.

--Adam
-- 
Adam D. Moss   . ,,^^   adam@gimp.org   http://www.foxbox.org/   co:3