That’s really no guarantee. Lua isn’t thread safe, and you should write your program with that in mind.
If you use threads when programming, you need to be aware of thread safety. There really is no other option.
It’s really not different from programming UI related things in various api’s (QT, JavaFX, etc) where you need to invoke the calls on the UI thread.
There are various ways to deal with communicating between threads. One way we use is to post commands to a shared data structure, that you can then process in your UpdateExtension
function.
Here’s such an example (https://github.com/defold/extension-admob/blob/master/admob/src/googlemobileads.cpp), although it should be noted that there too is an issue. In fact, we don’t protect that data queue with a lock of some kind (E.g. a mutex). To make sure that the data structure isn’t modified from two threads at once, you need to protect it.