Copying a global table across Lua states -


i have global table, which, want keep in sync, between 2 different lua states. have read, , understood, way seems be, in c back-end, deep copy of table between states (if table has been modified). there better way ? also, saw lua snippets table deep copy, not in c, there libraries [in c]?

p.s. not looking lua_thread based solution (i using it)

p.p.s lua lanes seems close, imo, seems much, because want sync 1 table!

note __newindex won't work if key exists in table you're writing to.

an alternative keep table empty never has real contents. can keep actual data in c, in case neither state needs have table populated , meta table can instead used view onto data thread. has bonus of not requiring data copy on either side data available on request.

a custom __pairs function iterate internal data if required, plus __index function @ data , you're away.


Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -