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
Trying to use String.split() from C++ GDNative resulted in crashes when trying to access the values, and bogus size() values.
It looks like godot-cpp/src/core/String.cpp is directly casting a godot_array into a PoolStringArray, which AFAICS are distinct types - shouldn't it be doing something more like this (which does appear to do the right thing for me)?
String s("Hello World! This string was split");
PoolStringArray p = s.split("");
Godot::print(String("String was split in ") + String::num_int64(p.size()));
PoolStringArray::Read r = p.read();
for (int i = 0; i < p.size(); ++i) {
Godot::print(r[i]);
}
Result:
String was split in 6
Hello
World!
This
string
was
split
Trying to use String.split() from C++ GDNative resulted in crashes when trying to access the values, and bogus size() values.
It looks like godot-cpp/src/core/String.cpp is directly casting a godot_array into a PoolStringArray, which AFAICS are distinct types - shouldn't it be doing something more like this (which does appear to do the right thing for me)?
Or even better, godot_string_split() should be returning a real pool_array to start with?
The text was updated successfully, but these errors were encountered: