comparison website/src/manual.html.luan @ 1797:ba43135bb98d

backticks docs
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 11 Feb 2024 18:52:53 -0700
parents 7d2ab44f7a59
children
comparison
equal deleted inserted replaced
1796:383703b581bc 1797:ba43135bb98d
1782 <p> 1782 <p>
1783 Results are returned using the <b>return</b> statement (see <a href="#control">Control Structures</a>). 1783 Results are returned using the <b>return</b> statement (see <a href="#control">Control Structures</a>).
1784 If control reaches the end of a function 1784 If control reaches the end of a function
1785 without encountering a <b>return</b> statement, 1785 without encountering a <b>return</b> statement,
1786 then the function returns with no results. 1786 then the function returns with no results.
1787 </p>
1788 <%
1789 end
1790 }
1791 backticks = {
1792 title = "Backticks"
1793 content = function()
1794 %>
1795 <p>
1796 A block between backticks is run and then whatever was sent to standard output is returned as a string. Examples:
1797 </p>
1798 <pre>
1799 local s = `%&gt;1 + 1 = &lt;%=1+1%&gt;&lt;%`
1800
1801 local s = ` fn(whatever) `
1802
1803 local s = `%&gt;
1804 ...
1805 &lt;%`
1806 </pre>
1807 <p>
1808 Backticks complement <a href="#template_stmt">template statements</a>.
1787 </p> 1809 </p>
1788 <% 1810 <%
1789 end 1811 end
1790 } 1812 }
1791 } 1813 }