Browse Source

Improve regex demo

Aaron Franke 5 years ago
parent
commit
abf9d68bf4
2 changed files with 7 additions and 6 deletions
  1. 6 5
      misc/regex/regex.gd
  2. 1 1
      misc/regex/regex.tscn

+ 6 - 5
misc/regex/regex.gd

@@ -1,12 +1,17 @@
 extends VBoxContainer
 
-# Member variables
 var regex = RegEx.new()
 
+func _ready():
+	$Text.set_text("They asked me \"What's going on \\\"in the manor\\\"?\"")
+	update_expression($Expression.text)
+
+
 func update_expression(text):
 	regex.compile(text)
 	update_text()
 
+
 func update_text():
 	for child in $List.get_children():
 		child.queue_free()
@@ -17,7 +22,3 @@ func update_text():
 				var label = Label.new()
 				label.text = result
 				$List.add_child(label)
-
-func _ready():
-	$Text.set_text("They asked me \"What's going on \\\"in the manor\\\"?\"")
-	update_expression($Expression.text)

+ 1 - 1
misc/regex/regex.tscn

@@ -2,7 +2,7 @@
 
 [ext_resource path="res://regex.gd" type="Script" id=1]
 
-[node name="VBoxContainer" type="VBoxContainer"]
+[node name="Regex" type="VBoxContainer"]
 anchor_right = 1.0
 anchor_bottom = 1.0
 margin_left = 14.0