+1 vote

I have this app .
And apparently the code in the editor is well the program runs normally. When I give the button calculate I get this error.

I connected the Calculate button with the function

https://www.facebook.com/photo.php?fbid=10208704741554192&set=gm.1009876762418547&type=3&theater

Here the code:

extends Panel
func ready():
pass
func Superficie
Cuadrado():
var Lado
var LadoKey = int(getnode("LadoBox").gettext())
if(LadoKey.isvalidinteger()):
Lado = int (Lado
Key)
else:
get_node("Error").show()
return

var Superficie = Lado * Lado
getnode("SuperficieBox").settext(str(Superficie))
func _on
Calcularpressed():
Superficie
Cuadrado()

in Engine by (78 points)

JUst for future reference, Please use the Code button to Add your code please (It's the button in the text editor here that has the { }

1 Answer

0 votes

Variable Lado_Key is integer, not the String, so you're calling is_valid_integer() on integer. Replace the line

var Lado_Key = int(get_node("Lado_Box").get_text())

with

var Lado_Key = get_node("Lado_Box").get_text()
by (830 points)

Thanks, works :D

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 Frequently asked questions and 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 [email protected] with your username.