Additional Information

It is also possible to pass (non-fundamental) objects to Lua via reference and thus modify them directly via Lua.

Pass by reference
try {
  CType c; c.mI = 4;

  std::string scr = R"(
    local c = ...
    c:seti(6)
  )";

  luaAPI.CallString(scr, &c);
  c.Output();
} catch (std::exception& e) {
  std::cout << e.what() << std::endl;
}