Fix typeof example in @GlobalScope docs#106768
Conversation
|
I would say that's it's better if the example compared to the returned value of typeof to the Variant.Type enum, and not just the int value. var json = JSON.new()
json.parse("[1, 2, 3, 5]")
var result = json.get_data()
if typeof(result) == TYPE_ARRAY:
print(result[0])
else:
print("Unexpected result!")Also, I think it's better if we keep the old example because it's a good case when you could use typeof. because it's checking the type of a method that returns variant. |
Thank you! I agree; I was just trying to follow the previous type example just above it in the documentation. I have modified it (I think), back to your suggestion. |
|
This needs a rebase after: |
I tried to resolve a conflict and add tabs according to this comment, but I am not sure about that last commit. I don't know why it says to merge the master branch into my typeof branch; I thought it was going the other way. Sorry! |
Co-Authored-By: Leftyluupy <99181178+leftyluupy@users.noreply.github.com>
93af7a9 to
d5df25f
Compare
typeof example in @GlobalScope docs
|
Thanks! Congratulations on your first merged contribution! 🎉 |
I added a (hopefully) more relevant example to the typeof() method in the @globalscope documentation, as per this issue: godotengine/godot-docs#10957
bugsquad edit:
Closes godotengine/godot-docs#10957.