How to access variables of the class that runs the Lua script from Lua
问题 I wonder if it's possible to access the variables of the class that runs the Lua script from the bound C++ class that is being used in Lua script. From the example below, I wonder if it's possible to access name variable in myLua class from the bound Test class somehow. Here are my codes. main.cpp : extern "C" { int luaopen_my(lua_State* L); } class myLua { public: struct myData { std::string name; lua_State *L; }; myLua(std::string name) { data = make_shared<myData>(); data->name = name;