[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Metatable check helper API proposal
- From: Sergey Zakharchenko <doublef.mobile@...>
- Date: Wed, 19 Aug 2020 19:06:23 +0400
Gé Weijers <firstname.lastname@example.org>:
> If this C variable is a static or global variable your code is no
> longer reentrant, so you could not use the library with two Lua states
> in your code.
Correct. If this is important, the metatable could be registered using
a dummy global variable pointer (lua_rawsetp) and a pointer to it
could be obtained by yet another API, say lua_rawgetpp = lua_rawgetp
followed by lua_topointer but without touching the stack. No writes to
the global 'variable' are needed, so it can be shared between states.
This does start looking a bit like API creep though (e.g. shall we
also add lua_rawgetip?) but it restores reentrancy and still avoids