Mercurial Hosting > luan
comparison website/src/manual.html.luan @ 472:f4aca5a5346a
minor documentation
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 10 May 2015 00:22:11 -0600 |
parents | 5627eb637eb4 |
children | 00646edc9d92 |
comparison
equal
deleted
inserted
replaced
471:f3a24435d04d | 472:f4aca5a5346a |
---|---|
1850 <p> | 1850 <p> |
1851 Could be defined as: | 1851 Could be defined as: |
1852 | 1852 |
1853 <p><tt><pre> | 1853 <p><tt><pre> |
1854 local function require(mod_name) | 1854 local function require(mod_name) |
1855 return Package.load(mod_name) or Luan.error("module '"..mod_name.."' not found") | 1855 return Package.load(mod_name) or <a href="#Luan.error">Luan.error</a>("module '"..mod_name.."' not found") |
1856 end | 1856 end |
1857 </pre></tt></p> | 1857 </pre></tt></p> |
1858 | 1858 |
1859 | 1859 |
1860 <h3 margin-top="1em"><a name="luan_lib">Basic Functions</a></h3> | 1860 <h3 margin-top="1em"><a name="luan_lib">Basic Functions</a></h3> |
1874 <p> | 1874 <p> |
1875 Could be defined as: | 1875 Could be defined as: |
1876 | 1876 |
1877 <p><tt><pre> | 1877 <p><tt><pre> |
1878 function Luan.assert(v,message) | 1878 function Luan.assert(v,message) |
1879 return v or Luan.error(message or "assertion failed!") | 1879 return v or <a href="#Luan.error">Luan.error</a>(message or "assertion failed!") |
1880 end | 1880 end |
1881 </pre></tt></p> | 1881 </pre></tt></p> |
1882 | 1882 |
1883 | 1883 |
1884 <h4 margin-top="1em"><a name="Luan.assert_binary"><tt>Luan.assert_binary (v)</tt></a></h4> | 1884 <h4 margin-top="1em"><a name="Luan.assert_binary"><tt>Luan.assert_binary (v)</tt></a></h4> |
1887 Could be defined as: | 1887 Could be defined as: |
1888 | 1888 |
1889 <p><tt><pre> | 1889 <p><tt><pre> |
1890 function Luan.assert_binary(v) | 1890 function Luan.assert_binary(v) |
1891 local v_type = Luan.type(v) | 1891 local v_type = Luan.type(v) |
1892 return v_type == "binary" and v or Luan.error("bad argument #1 (binary expected, got "..v_type..")") | 1892 return v_type == "binary" and v or <a href="#Luan.error">Luan.error</a>("bad argument #1 (binary expected, got "..v_type..")") |
1893 end | 1893 end |
1894 </pre></tt></p> | 1894 </pre></tt></p> |
1895 | 1895 |
1896 | 1896 |
1897 <h4 margin-top="1em"><a name="Luan.assert_boolean"><tt>Luan.assert_boolean (v)</tt></a></h4> | 1897 <h4 margin-top="1em"><a name="Luan.assert_boolean"><tt>Luan.assert_boolean (v)</tt></a></h4> |
1935 <p> | 1935 <p> |
1936 Could be defined as: | 1936 Could be defined as: |
1937 | 1937 |
1938 <p><tt><pre> | 1938 <p><tt><pre> |
1939 function Luan.do_file(uri) | 1939 function Luan.do_file(uri) |
1940 return load_file(uri)() | 1940 return Luan.load_file(uri)() |
1941 end | 1941 end |
1942 </pre></tt></p> | 1942 </pre></tt></p> |
1943 | 1943 |
1944 | 1944 |
1945 | 1945 |