Error in GD,The program has an error

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By RetroDan007
:warning: Old Version Published before Godot 3 was released.

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

Here the code:

extends Panel
func _ready():
pass
func Superficie_Cuadrado():
var Lado
var Lado_Key = int(get_node(“Lado_Box”).get_text())
if(Lado_Key.is_valid_integer()):
Lado = int (Lado_Key)
else:
get_node(“Error”).show()
return

var Superficie = Lado * Lado
get_node(“Superficie_Box”).set_text(str(Superficie))
func _on_Calcular_pressed():
Superficie_Cuadrado()

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 { }

The_Duskitty | 2016-03-17 16:31

:bust_in_silhouette: Reply From: GlaDOSik

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()

Thanks, works :smiley:

RetroDan007 | 2016-03-17 18:25