diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/func_ref.cpp | 5 | ||||
-rw-r--r-- | core/ustring.cpp | 5 |
2 files changed, 7 insertions, 3 deletions
diff --git a/core/func_ref.cpp b/core/func_ref.cpp index 893f7f9103..7e062f16d0 100644 --- a/core/func_ref.cpp +++ b/core/func_ref.cpp @@ -92,7 +92,10 @@ void FuncRef::_bind_methods() { ClassDB::bind_method(D_METHOD("call_funcv", "arg_array"), &FuncRef::call_funcv); ClassDB::bind_method(D_METHOD("set_instance", "instance"), &FuncRef::set_instance); + ClassDB::bind_method(D_METHOD("is_valid"), &FuncRef::is_valid); + ClassDB::bind_method(D_METHOD("set_function", "name"), &FuncRef::set_function); ClassDB::bind_method(D_METHOD("get_function"), &FuncRef::get_function); - ClassDB::bind_method(D_METHOD("is_valid"), &FuncRef::is_valid); + + ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "function"), "set_function", "get_function"); } diff --git a/core/ustring.cpp b/core/ustring.cpp index d5afbc2b47..0033c31e20 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -4484,11 +4484,12 @@ String String::sprintf(const Array &values, bool *error) const { int number_len = str.length(); // Padding. + int pad_chars_count = (value < 0 || show_sign) ? min_chars - 1 : min_chars; String pad_char = pad_with_zeroes ? String("0") : String(" "); if (left_justified) { - str = str.rpad(min_chars, pad_char); + str = str.rpad(pad_chars_count, pad_char); } else { - str = str.lpad(min_chars, pad_char); + str = str.lpad(pad_chars_count, pad_char); } // Sign. |