godot-cpp icon indicating copy to clipboard operation
godot-cpp copied to clipboard

Added functionality for allow_empty param in String::split_ints and split_floats

Open HrishikeshP-01 opened this issue 3 years ago • 6 comments

Removed the allow_empty param of the split_ints and split_floats functions in String.hpp and String.cpp as this param was unused.

HrishikeshP-01 avatar Feb 04 '21 04:02 HrishikeshP-01

This argument is part of the API: https://docs.godotengine.org/en/stable/classes/class_string.html#class-string-method-split-floats It should not be removed. The problem is that it should be functional.

Zylann avatar Feb 06 '21 20:02 Zylann

I was under the impression that the work-around left the parameter useless. Is making it functional using the Godot C API what you have in mind?

HrishikeshP-01 avatar Feb 07 '21 20:02 HrishikeshP-01

Yes, I opened an issue to track this: https://github.com/godotengine/godot-cpp/issues/498

Zylann avatar Feb 07 '21 20:02 Zylann

Got it. Thanks!

HrishikeshP-01 avatar Feb 07 '21 20:02 HrishikeshP-01

Let me know if any changes are needed. Also in the original code PoolIntArray String::split_ints(String divisor, bool /*allow_empty*/) const { godot_array arr = godot::api->godot_string_split_floats(&_godot_string, &divisor._godot_string); return Array(arr); } split_ints also uses the godot_string_split_floats function. I'm not sure if it was intended or overlooked. Anyways I've changed it to use godot_string_split_ints function. I hope that's right.

HrishikeshP-01 avatar Feb 07 '21 21:02 HrishikeshP-01

Looks good to me. The commits should be squashed into one though. Not sure if @Zylann has something else to add.

vnen avatar Mar 01 '21 14:03 vnen

Is this still relevant? It seems like String is no longer a part of godot-cpp, only CharString.

aaronfranke avatar Jul 08 '23 17:07 aaronfranke

String is "part" of godot-cpp, but is generated code. So such changes should be done to Godot itself I guess

Zylann avatar Jul 08 '23 17:07 Zylann