Skip to content

Multi Thread Support

qtiuto edited this page Dec 31, 2018 · 1 revision

A userdata named 'cross' is imported to support cross-thread communication. It behaves like a table,so you can just put any lua object to it.

Note that userdata is shared by memory copy so if it has a _gc metamethod,error will be raised, since it may induce memory corruption.

Corutine can't be shared also since it has its own lua state, and a lua state can't be shared cross thread.Take care that all key will be converted to string.

Never put a value has references to the global table, or a stack overflow error may occur.