+1 vote

Hi everyone,

every now and then I stumble over an error-message like the one in this case:

if "," in text.erase():
    print ("comma erased")

error(109,1): Too few arguments for "erase()" call. Expected at least 2.

Whatever I try to put into those (), nothing seems to work. How can I find out what arguments I need in such a case?

in Engine by (355 points)

1 Answer

0 votes
Best answer

At the top left of the script editor, click "search help" and type the method. A list with all the methods from any class with a method with such a name will appear so just click the relevant one and you will be given a description of what the method does and the arguments it requires.

by (1,051 points)
selected by

In case of "erase" there's a lot coming up - selecting the one under "String" leads to this then:

void erase(position: int, chars: int)
Erases chars characters from the string starting from position.

I guess it's a good idea to practice search-help a bit indeed...
Thank you!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.