Skip to content

Commit

Permalink
fix: stops negative numbers being interpreted as strings (#511)
Browse files Browse the repository at this point in the history
Co-authored-by: Balloonpopper <[email protected]>
  • Loading branch information
balloonpopper and Balloonpopper authored Feb 25, 2022
1 parent 712014f commit 5adf5b8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions addons/escoria-core/game/core-scripts/utils/esc_utils.gd
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ func get_typed_value(value: String, type_hint = []):
var regex_bool = RegEx.new()
regex_bool.compile("^true|false$")
var regex_float = RegEx.new()
regex_float.compile("^[0-9]+\\.[0-9]+$")
regex_float.compile("^-?[0-9]+\\.[0-9]+$")
var regex_int = RegEx.new()
regex_int.compile("^[0-9]+$")
regex_int.compile("^-?[0-9]+$")

if regex_float.search(value):
return float(value)
Expand Down

0 comments on commit 5adf5b8

Please sign in to comment.