Mercurial Hosting > luan
diff website/src/manual.html.luan @ 567:6c00b8a59240
document Binary
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 05 Jul 2015 19:29:56 -0600 |
parents | 90b93790c544 |
children | 1e69d9c21461 |
line wrap: on
line diff
--- a/website/src/manual.html.luan Sun Jul 05 18:26:04 2015 -0600 +++ b/website/src/manual.html.luan Sun Jul 05 19:29:56 2015 -0600 @@ -91,6 +91,7 @@ <li><a href="#luan_lib">Basic Functions</a></li> <li><a href="#package_lib">Modules</a></li> <li><a href="#string_lib">String Manipulation</a></li> + <li><a href="#binary_lib">Binary Manipulation</a></li> <li><a href="#table_lib">Table Manipulation</a></li> <li><a href="#number_lib">Number Manipulation</a></li> <li><a href="#math_lib">Mathematical Functions</a></li> @@ -2657,6 +2658,40 @@ +<h3 heading><a name="binary_lib">Binary Manipulation</a></h3> + +<p> +Include this library by: + +<pre> + local Binary = require "luan:Binary" +</pre> + + +<h4 heading><a name="Binary.binary"><code>Binary.binary (···)</code></a></h4> + +<p> +Receives zero or more bytes (as integers). +Returns a binary with length equal to the number of arguments, +in which each byte has the internal numerical code equal +to its corresponding argument. + + +<h4 heading><a name="Binary.byte"><code>Binary.byte (b [, i [, j]])</code></a></h4> + +<p> +Returns the internal numerical codes of the bytes <code>b[i]</code>, +<code>b[i+1]</code>, ..., <code>b[j]</code>. +The default value for <code>i</code> is 1; +the default value for <code>j</code> is <code>i</code>. +These indices are corrected +following the same rules of function <a href="#String.sub"><code>String.sub</code></a>. + + +<h4 heading><a name="Binary.to_string"><code>Binary.to_string (b)</code></a></h4> +<p> +Converts the binary <code>b</code> to a string using the Java <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#String(byte[])">String constructor</a>. +