This is only a problem with certain classes of code mostly dealing
with userdata types. For example releasing COM objects may need to be
done from the correct thread. As far as I know the Lua types and
their collection are thread-safe.
The lua_lock and lua_unlock macros are not recommended: they slow
things down *a lot* because they are used often.
I think this is a misconception. Where is it not recommended? It's
highly dependant on how efficient your locking mechanism is and you
get to determine the locking mechanism. For example on Windows I see
no measurable slowdown at all when using CriticalSection locking. In
my pthread version I see about a 25% slowdown but I'm using a slow
implementation that has plenty of room for improvement.
CR