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
sol::property
Consider the following:
#include <sol/sol.hpp> #include <cassert> struct X { static inline int v = 1; static void set_var(int value) { X::v = value; } static int get_var() { return X::v; } }; int main() { std::printf("sol: %s\n", SOL_VERSION_STRING); sol::state L; L.open_libraries(); auto x = L.new_usertype<X>("X"); x["v"] = sol::property(&X::set_var, X::get_var); // value == 1? L.safe_script("assert(X.v == 1)"); assert(X::v == 1); // modify from cpp.. X::v = 2; // value == 2? L.safe_script("assert(X.v == 2)"); assert(X::v == 2); // modify from lua.. L.safe_script("X.v = 3"); // value == 3? L.safe_script("assert(X.v == 3)"); assert(X::v == 3); // BOOM }
Note, that last assertion fails.
I think it's similar to #1267
The text was updated successfully, but these errors were encountered:
sol::var
std::ref
No branches or pull requests
Consider the following:
Note, that last assertion fails.
I think it's similar to #1267
The text was updated successfully, but these errors were encountered: