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? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
lua_state.new_usertype<Vector_t>("vector", sol::constructors <Vector_t(), Vector_t(float, float, float)>(), "x", &Vector_t::x, "y", &Vector_t::y, "z", &Vector_t::z ); local vec = vector.new(0,0,0); -- attempt to call field 'new' (a nil value)
The text was updated successfully, but these errors were encountered:
Can you provide more information? For example what version of sol you are using, what version of lua, how Vector_t looks like exactly?
I tried to replicate the issue in godbolt but I did not succeed: https://godbolt.org/z/6Yxz7o6od Everything seems to work fine.
#include <limits> #define SOL_ALL_SAFETIES_ON 1 #include <sol/sol.hpp> struct Vector_t { int x,y,z; }; int main() { sol::state lua; lua.open_libraries(); lua.new_usertype<Vector_t>("vector", sol::constructors <Vector_t(), Vector_t(float, float, float)>(), "x", &Vector_t::x, "y", &Vector_t::y, "z", &Vector_t::z ); lua.script(R"( local v = vector.new() print(v.x, v.y, v.z) local v = vector.new(1,2,3) print(v.x, v.y, v.z) local v = vector.new(0,0,0) print(v.x, v.y, v.z) )"); return 0; }
Sorry, something went wrong.
No branches or pull requests
The text was updated successfully, but these errors were encountered: