The issue is found in the red text. If you change the value of command in an alias, that change DOES pass through to all later aliases. However, the value of command does NOT affect pattern matching. Pattern matching always uses the initial input command. For example:The initial user command is being held in the Lua variable command. When this value changes within the alias unit processing chain, the initial user input that the aliases work on can be rewritten and changed in the process. Consequently, you can substitute the user input step by step - or alias by alias - without that anything happens as far as sending commands is being concerned unless you explicitly decide to do so.
Alias 1: Match: .*, Script: command = "A" .. command
Alias 2: Match: ^A, Script: echo("cmd = " .. command)
Alias 3: Match: .*, Script: echo("Result = " .. command)
If you enter the text "xyz", the output you get is: "Result = Axyz" because Alias 1 changes the value of command. But this doesn't cause Alias 2 to fire. If you enter "Abc" you get: "cmd = AAbc" and "Result = AAbc", so clearly command has the 'A' prefixed in alias 2.
Is this how it is supposed to work?
NOTE: How the aliases are arranged (nested or not) does not change this behavior.