Navigation menu

Engine:CCMD run: Difference between revisions

Jump to navigation Jump to search
4 bytes removed ,  16 October 2023
Line 163: Line 163:
</kua>
</kua>
: 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.
: 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.
===== Without back ticks =====
<kua>
> lua run 'print "bob"'
bob
</kua>
: Above calls the 'lua' context 'run' command, and as normal 'print "bob"' is a complete parameter for 'run', that then gets executed in the Lua runtime all together.
<kua>
<kua>
> lua print "bob"
> lua print "bob"
Line 176: Line 170:
</kua>
</kua>
: Passed directly to the 'lua' context verbatim and treated necessarily as a command to be run. This fails as 'print is not a valid 'lua' context command, and 'print "bob"' is not valid Lua.
: Passed directly to the 'lua' context verbatim and treated necessarily as a command to be run. This fails as 'print is not a valid 'lua' context command, and 'print "bob"' is not valid Lua.
===== Other examples =====
<kua>
> lua run 'print "bob"'
bob
</kua>
: Above calls the 'lua' context 'run' command, and as normal 'print "bob"' is a complete parameter for 'run', that then gets executed in the Lua runtime all together.
<kua>
<kua>
> lua `
> lua `