49
edits
| Line 158: | Line 158: | ||
==== Special delimiters ==== | ==== Special delimiters ==== | ||
:1. Back ticks surrounding text passed directly to a context will be stripped, such that the resulting text will get treated as a script block to be run in the context. Normally all text is passed verbatim, including quotes. This is useful for multi-line scripts, as normally all text on the same line will be passed without quotes anyway. | :1. Back ticks surrounding text passed directly to a context will be stripped, such that the resulting text will get treated as a script block to be run in the context. Normally all text is passed verbatim, including quotes. This is useful for multi-line scripts, as normally all text on the same line will be passed without quotes anyway. | ||
<kua> | |||
> lua `print "bob"` | |||
bob | |||
</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. | |||
===== Without back ticks ===== | |||
<kua> | <kua> | ||
> lua run 'print "bob"' | > lua run 'print "bob"' | ||
| Line 170: | Line 176: | ||
</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. | ||
<kua> | <kua> | ||
> lua ` | > lua ` | ||