You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Suppose I have this function in C++ : void ShaderSetUniformF(ShaderID ID, const std::string& name, std::vector<float> values);
Now in lua, if I write: ShaderSetUniformF(shader_multi,"col",{0.1, 0.1, 0.4, 1.0})
Things work as expected.
My question is if this is not the best way to do this, as I am using the values parameter by, erm, value, and if there is any better way. I'm asking this because, for instance, void ShaderSetUniformF(ShaderID ID, const std::string& name, std::vector<float>& values);
doesn't work (I get an error).
So, is there a good way to pass containers around by reference and still work?
The text was updated successfully, but these errors were encountered:
Lua tables are far from being C++ std::vectors. Also Lua uses doubles and your std::vector contains floats, so vector references can't possibly point to the original table.
Hello,
Suppose I have this function in C++ :
void ShaderSetUniformF(ShaderID ID, const std::string& name, std::vector<float> values);
Now in lua, if I write:
ShaderSetUniformF(shader_multi,"col",{0.1, 0.1, 0.4, 1.0})
Things work as expected.
My question is if this is not the best way to do this, as I am using the
values
parameter by, erm, value, and if there is any better way. I'm asking this because, for instance,void ShaderSetUniformF(ShaderID ID, const std::string& name, std::vector<float>& values);
doesn't work (I get an error).
So, is there a good way to pass containers around by reference and still work?
The text was updated successfully, but these errors were encountered: