lua-users home
lua-l archive

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


On Wed, Sep 13, 2017 at 5:50 PM, ThePhD <> wrote:
> Sorry for the confusing post. Yes, I wanted to know if a thread was a main
> one or not, because 2 threads being main threads meant they would not be
> "lua_xmove"-able to one another. I probably should have titled this more
> appropriately and asked directly about checking the "lua_xmove"-ability, but
> the information about "lua_pushthread" is helpful too.

You are just asking whether you can xmove? I think your registry to
pointer trick is a nice easy one, it says different objects, different
pointers ( without caveats about being from different states, and it
would need a really perverse implementation to work like that ), and
as the registry exists always it should be just a comparison, no need
to worry about nulls.

And the thing is, if you look at the source, lua_xmove is protected
against moves between different states (  it asserts ) by using a
simple comparison, but the relevant macro is undocumented, so better
not use it.

Francisco Olarte.