Open xhighway999 opened 2 years ago
Hi, I am struggling to iterate over the properties of a sol usertype. Let's imagine the following vector example:
sol::usertype<itero::Vector3f> vector3_type = s.new_usertype<itero::Vector3f>("Vector3f", sol::constructors<itero::Vector3f(), itero::Vector3f(float,float,float)>()); vector3_type["x"] = &itero::Vector3f::x; vector3_type["y"] = &itero::Vector3f::y; vector3_type["z"] = &itero::Vector3f::z;
How can I find the x,y, and z properties iteratively without a name? I am looking for something like this:
local vec = Vector3f.new() for k,v in pairs(vec) do print(k) end
The output would be something like
x y z
Is this already available? I couldn't find anything in the documentation. Thanks in advance, xhighway999
see https://github.com/ThePhD/sol2/issues/146
Hi, I am struggling to iterate over the properties of a sol usertype. Let's imagine the following vector example:
How can I find the x,y, and z properties iteratively without a name? I am looking for something like this:
The output would be something like
Is this already available? I couldn't find anything in the documentation. Thanks in advance, xhighway999