lua-users home
lua-l archive

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


> | static int throw_error_at_old_thread(lua_State *cur_L)
> | {
> |     lua_error(old_L);
>
> The Lua Reference Manual (5.4) declares that:
> 
> | As a general rule, when a C function is called by Lua with a Lua state,
> | it can do whatever it wants on that Lua state, as it should be already
> | protected.  However, when C code operates on *other* Lua states (e.g., a
> | Lua-state argument to the function, a Lua state stored in the registry,
> | or the result of lua_newthread), it should use them only in API calls
> | that cannot raise errors.
> 
> In my opinion, "other" means "not protected", but Mike Pall says, that
> it means "not currently executed" [2].

That sentence starts mentioning "a Lua state", the one the function was
called with; that is "curr_L" in your example. "Other Lua states" mean
any Lua state which is not "curr_L".

-- Roberto