Topic was automatically imported from the old Question2Answer platform.
Asked By
todog
Hi,
New to Godot
Trying to use the “match array” feature but can’t get a match as expected. Ordinary matching works for me.
My code:
enter code here
var s = $PanelCommand/LineEditCommand.text.split(' ', true, 2)
prints(s)
match s:
[]:
prints("no command")
["go", var destination]:
prints("command go to ", destination)
["go"]:
prints("command go")
["stop"]:
prints("command stop")
_:
prints("no match")
Output with various values:
[go, 1]
no match
[go]
no match
[stop]
no match
no match
I see that split returns PoolStringArray but would have thought match would work with that.