2024-07-30 09:03:10 +02:00
|
|
|
@import ../template.nml
|
2024-07-30 16:40:14 +02:00
|
|
|
%<make_doc({"Lua"}, "Lua", "Lua Basics")>%
|
2024-07-29 21:28:06 +02:00
|
|
|
|
|
|
|
# Running lua code
|
|
|
|
|
|
|
|
Running lua code is done using the following syntax:
|
|
|
|
``Lua, %<print("Hello World!")>%``
|
|
|
|
|
|
|
|
## Lua to text
|
|
|
|
To convert the return value of your lua code, append ``"`` at the start of your lua expression:
|
|
|
|
* ``Lua, %<"return "Hello World">%`` → %<"return "Hello World">%
|
|
|
|
* ``Lua, %<" "Hello, " .. "World">%`` → %<" "Hello, " .. "World">%
|
|
|
|
|
|
|
|
## Parse lua string
|
|
|
|
Additionnaly, you can output lua to be parsed by the document's parser. To do so, append ``!`` at the start of your lua expression:
|
|
|
|
* ``Lua, %<!"**" .. "Bold from lua?" .. "**">%`` → %<!"**" .. "Bold from lua?" .. "**">%
|
|
|
|
* ``Lua, %<!"[" .. "Link from Lua" .. "](#)">%`` → %<!"[" .. "Link from Lua" .. "](#)">%
|