We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm looking for a way to invalidate Lua references so I can match their lifetimes to the CPP object they point to.
It looks like manually setting the metatable to nil is one option:
{ Test test; test.a = 54; lua["test"] = &test; sol::userdata testRef = lua["test"]; lua.script(R"( print(test, test.a) )"); testRef[sol::metatable_key] = sol::nil; } // script error instead of dereferencing a dangling pointer lua.script(R"( print(test, test.a) )");
Are there any problems with doing this? Is there a better way?
The text was updated successfully, but these errors were encountered:
You may be interested in this issue as well #1367
Sorry, something went wrong.
No branches or pull requests
I'm looking for a way to invalidate Lua references so I can match their lifetimes to the CPP object they point to.
It looks like manually setting the metatable to nil is one option:
Are there any problems with doing this? Is there a better way?
The text was updated successfully, but these errors were encountered: