This is the testing Godot forums! All forum posts unique to this forum will be deleted! Please use the main forums here for any posts you want to keep. All forum rules still apply.

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.

Tags :

Best Answer

  • KioriKiori Posts: 246
    Accepted 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

Answers

  • KioriKiori Posts: 246Member
    Accepted 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

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.