blackbutterfly
Emperor
in the page you've linked, see
Code:ExposedMembers.SaveTableToSlot = SaveTableToSlot
at the end of the first code block (the one in UI context)
it then allows the use of
Code:ExposedMembers.SaveTableToSlot(t, "myTable")
in any context, once all files are loaded.
you can also pass values using LuaEvents as shown here :
https://forums.civfanatics.com/threads/help-with-changegoldbalance.623730/#post-14900833
Ok. My 2¢ re: thread safety:
Writing to tables via SQL transactions is thread safe. So one feature of Lua, that the Table is the principle data type with seamless RW to/from SQL DB tables is an advantage for inter-process communication.
Traditional software languages achieve this by using one model of concurrent computing known as Software Transactional Memory, which basically mimics the RDBMS transaction model for shared memory/data.
As for the second method using Lua events, I have no idea if they are thread safe, as a relatively noob at Lua. Does anyone know?