mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 15:01:53 +08:00
17 lines
383 B
GDScript
17 lines
383 B
GDScript
|
|
class_name Composables
|
||
|
|
|
||
|
|
static func useHistoryStack(input: LineEdit):
|
||
|
|
var stack = Reference.new([input.text])
|
||
|
|
var lastText = Reference.new("")
|
||
|
|
var getLast = func(index: int):
|
||
|
|
return stack.getData()[stack.getData().size() - index - 1]
|
||
|
|
input.text_changed.connect(func(text):
|
||
|
|
lastText.setData(text)
|
||
|
|
stack.getData().append(text)
|
||
|
|
)
|
||
|
|
return [
|
||
|
|
stack,
|
||
|
|
getLast,
|
||
|
|
lastText
|
||
|
|
]
|