Why do I get the outpot "Object ID: ...."

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By jabba

Hi All,

I want to make a simple calculater, so I started with getting the output after the user types something in the LineEdit node. But the output isnt what it should be instead it is “Object ID: 1139”.

My code is as following:

extends Node

onready var ValueOne = $ValueOne
onready var ValueTwo = $ValueTwo

func _ready():

func _on_Button_button_up() → void:
var Val1 = str(ValueOne)

:bust_in_silhouette: Reply From: njamster

You’re setting the text of $Answer with the value of Val1 which is the LineEdit-node ValueOne casted to a string instead of the text it contains. This will work:

func _on_Button_button_up() -> void:
	var Val1 = ValueOne.get_text()