Saulo Cabral
Saulo Cabral

Reputation: 113

Share Global variables

How to share global variables between two different lua_state?

The lua_state can not be created with lua_newthread.

Help please

Upvotes: 0

Views: 297

Answers (1)

Nicol Bolas
Nicol Bolas

Reputation: 474476

You cannot directly share components from one lua_State with another. The only cross connection you can have between lua_States is via the intervention of some C or C++ code. You can register the same function in multiple states, and thereby access the same resource from both. But you have to do it through functions and C/C++/etc objects, not directly through Lua.

Upvotes: 2

Related Questions