lua-users home
lua-l archive

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


On Wed, Aug 19, 2020 at 7:20 AM Sergey Zakharchenko
<doublef.mobile@gmail.com> wrote:
>
>
> Right; that's why I abandoned that in favor of C pointer comparisons.
> Library init code could create a metatable, ref it so that it doesn't
> go away, call lua_topointer on it and store the pointer in a C
> variable, then use it for comparison inside the C metamethod.

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. This may not be an issue for you, but the technique is
not universally applicable.


Gé