Get sum from a string or array

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

I’m trying to find the best method to calculate a string or an array.

For Example, “1 + 20 - 3” and return sum. I also thought about using an array with numbers and string math symbols like this: [1, “+”, 20, “-”, 3] and return sum.

The reason i’m asking is that I imagine there is a math or sum function that does this and I’m just unable to find it.

:bust_in_silhouette: Reply From: tuon

You’re looking for the Expression class. See the Godot docs for details.