Can one type change metadata?

1000h1000h Posts: 133Member
edited September 2016 in Programming
EDITED: I think just found my problem.  Will flag as answered soon, I suspect

Solution to problem:

You cannot type cast a string to an integer within the for loop that has created the string you are trying to type cast.
Other type casts seem to work, but not string->int.

This is within GDScript


There is the .is_valid_integer() method, but it says, even though I can print the meta data and get a fitting result, that when I try to do the .is_valid_integer() method on the meta data, it says that I was trying to use the method on a null object

var integer_as_str = "100"
print(int(integer_as_str))
>>> 100

var phone_number = spatial.get_meta("phone_number_as_string") #a meta string
print(phone_number)
>>> 12345678

print(int(phone_number))
print >>> Error: Invalid Call. Nonexistent 'int' constructor.
Tagged:

Tags :

Answers

  • KioriKiori Posts: 246Member
    Answer ✓
    Solution to problem:

    You cannot type cast a string to an integer within the for loop that has created the string you are trying to type cast.
    Other type casts seem to work, but not string->int.

    This is within GDScript
Sign In or Register to comment.