lua-users home
lua-l archive

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


>> Use the registry. It's there for these kind of uses.
>
>Is it threadsafe?

If you mean Lua threads, then yes.
If you mean OS threads, then yes, if you compile Lua to use the appropriate
lock mechanism (#define lua_lock and lua_unlock).

>And where store the pointer to userdata?

Which userdata? Anyway, the registry is just an ordinary Lua table, which you
can use as you please.

>Or in each function to set errcode must do someth.:
>lua_pushliteral(L, "ec");
>lua_pushnumber(L, errcode);
>lua_settable(L, LUA_REGISTRYINDEX);

Yes, something like this.
--lhf