Engine:CCMD run: Difference between revisions

629 bytes added ,  16 October 2023
Line 174: Line 174:
bob
bob
</kua>
</kua>
: Back ticks effectively treat the rest of the statement as a block, by being preemptively removed before passing to the context. This allows the block to execute as though were actually in the 'lua' context. Quotes are not removed normally as they may be important to the context's command processing. Back ticks are special in that they will be removed from the start and end of the script statement. Without this special behavior, there would be no way to run a multi-line command block for an associated context, without switching to it first.
: Back ticks effectively treat the rest of the statement as a block, by being preemptively removed before passing to the context, and execute as though were actually in the 'lua' context. Quotes are not removed normally as they may be important to the context's command processing. Back ticks are special in that they will be removed from the start and end of the script statement. Without this special behavior, there would be no way to run a multi-line command block for an associated context, without switching to it first.
<kua>
> lua `
  print "bob"
  print "bob"
`
bob
bob
</kua>
: Here effectively as a block inside 'lua'
<kua>
> context lua
> print "bob"
bob
> print "bob"
bob
> context global
</kua>
: And same thing but switching and executing asn switching back.
<kua>
> notthere `
  print(1+2)
  print(1+2)
`
Unknown: notthere
</kua>
: The context did not exist and didn't run the block. In this case, guards against running commands in wrong context, if the context didn't exist at that time.
<kua>
> context notthere
> print(1+2)
Unknown: print(1+2)
> print(1+2)
Unknown: print(1+2)
> context global
</kua>
: This time commands are run in the unintended context.


== Notes ==
== Notes ==
*
*