mirror of
https://github.com/Relintai/pandemonium_demo_projects.git
synced 2024-12-21 13:56:50 +01:00
25 lines
532 B
GDScript
25 lines
532 B
GDScript
extends VBoxContainer
|
|
|
|
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()
|
|
if regex.is_valid():
|
|
var matches = regex.search($Text.get_text())
|
|
if matches != null:
|
|
for result in matches.get_strings():
|
|
var label = Label.new()
|
|
label.text = result
|
|
$List.add_child(label)
|