Skip to content

Commit

Permalink
Better bbcode_escape() implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
limbonaut committed Sep 10, 2024
1 parent ee36b65 commit 9302217
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions limbo_console.gd
Original file line number Diff line number Diff line change
Expand Up @@ -740,15 +740,11 @@ func _calculate_osa_distance(s1: String, s2: String) -> int:


func _bbcode_escape(p_text: String) -> String:
var ret: String
for c in p_text:
if c == '[':
ret += "[lb]"
elif c == ']':
ret += "[rb]"
else:
ret += c
return ret
return p_text \
.replace("[", "~LB~") \
.replace("]", "~RB~") \
.replace("~LB~", "[lb]") \
.replace("~RB~", "[rb]")


func _get_method_info(p_callable: Callable) -> Dictionary:
Expand Down

0 comments on commit 9302217

Please sign in to comment.