Mercurial Hosting > luan
comparison website/src/manual.html.luan @ 1164:1f9d34a6f308
remove assertions
| author | Franklin Schmidt <fschmidt@gmail.com> |
|---|---|
| date | Wed, 07 Feb 2018 17:36:38 -0700 |
| parents | ad6b3b9fef40 |
| children | 73d754b1889f |
comparison
equal
deleted
inserted
replaced
| 1163:fef8f0742da9 | 1164:1f9d34a6f308 |
|---|---|
| 1802 | 1802 |
| 1803 <p> | 1803 <p> |
| 1804 The basic library provides basic functions to Luan that don't depend on other libaries. | 1804 The basic library provides basic functions to Luan that don't depend on other libaries. |
| 1805 | 1805 |
| 1806 | 1806 |
| 1807 <h4 heading><a name="Luan.assert" href="#Luan.assert"><code>Luan.assert (v [, message])</code></a></h4> | |
| 1808 | |
| 1809 <p> | |
| 1810 Could be defined as: | |
| 1811 | |
| 1812 <pre> | |
| 1813 function Luan.assert(v,message) | |
| 1814 return v or <a href="#Luan.error">Luan.error</a>(message or "assertion failed!") | |
| 1815 end | |
| 1816 </pre> | |
| 1817 | |
| 1818 | |
| 1819 <h4 heading><a name="Luan.assert_binary" href="#Luan.assert_binary"><code>Luan.assert_binary (v)</code></a></h4> | |
| 1820 | |
| 1821 <p> | |
| 1822 Could be defined as: | |
| 1823 | |
| 1824 <pre> | |
| 1825 function Luan.assert_binary(v) | |
| 1826 local v_type = Luan.type(v) | |
| 1827 return v_type == "binary" and v or <a href="#Luan.error">Luan.error</a>("bad argument #1 (binary expected, got "..v_type..")") | |
| 1828 end | |
| 1829 </pre> | |
| 1830 | |
| 1831 | |
| 1832 <h4 heading><a name="Luan.assert_boolean" href="#Luan.assert_boolean"><code>Luan.assert_boolean (v)</code></a></h4> | |
| 1833 | |
| 1834 <p> | |
| 1835 Like <a href="#Luan.assert_binary"><code>assert_binary</code></a> but for type <code>boolean</code>. | |
| 1836 | |
| 1837 | |
| 1838 <h4 heading><a name="Luan.assert_function" href="#Luan.assert_function"><code>Luan.assert_function (v)</code></a></h4> | |
| 1839 | |
| 1840 <p> | |
| 1841 Like <a href="#Luan.assert_binary"><code>assert_binary</code></a> but for type <code>function</code>. | |
| 1842 | |
| 1843 | |
| 1844 <h4 heading><a name="Luan.assert_integer" href="#Luan.assert_integer"><code>Luan.assert_integer (v)</code></a></h4> | |
| 1845 | |
| 1846 <p> | |
| 1847 Asserts that <code>v</code> can be converted to Java type <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Integer.html">Integer</a> and returns an Integer. | |
| 1848 | |
| 1849 | |
| 1850 <h4 heading><a name="Luan.assert_long" href="#Luan.assert_long"><code>Luan.assert_long (v)</code></a></h4> | |
| 1851 | |
| 1852 <p> | |
| 1853 Asserts that <code>v</code> can be converted to Java type <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Long.html">Long</a> and returns a Long. | |
| 1854 | |
| 1855 | |
| 1856 <h4 heading><a name="Luan.assert_number" href="#Luan.assert_number"><code>Luan.assert_number (v)</code></a></h4> | |
| 1857 | |
| 1858 <p> | |
| 1859 Like <a href="#Luan.assert_binary"><code>assert_binary</code></a> but for type <code>number</code>. | |
| 1860 | |
| 1861 | |
| 1862 <h4 heading><a name="Luan.assert_string" href="#Luan.assert_string"><code>Luan.assert_string (v)</code></a></h4> | |
| 1863 | |
| 1864 <p> | |
| 1865 Like <a href="#Luan.assert_binary"><code>assert_binary</code></a> but for type <code>string</code>. | |
| 1866 | |
| 1867 | |
| 1868 <h4 heading><a name="Luan.assert_table" href="#Luan.assert_table"><code>Luan.assert_table (v)</code></a></h4> | |
| 1869 | |
| 1870 <p> | |
| 1871 Like <a href="#Luan.assert_binary"><code>assert_binary</code></a> but for type <code>table</code>. | |
| 1872 | |
| 1873 | |
| 1874 <h4 heading><a name="Luan.do_file" href="#Luan.do_file"><code>Luan.do_file ([uri])</code></a></h4> | 1807 <h4 heading><a name="Luan.do_file" href="#Luan.do_file"><code>Luan.do_file ([uri])</code></a></h4> |
| 1875 | 1808 |
| 1876 <p> | 1809 <p> |
| 1877 Could be defined as: | 1810 Could be defined as: |
| 1878 | 1811 |
