changeset 567:6c00b8a59240

document Binary
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 05 Jul 2015 19:29:56 -0600
parents 90b93790c544
children aa17ad66a370
files core/src/luan/modules/Binary.luan website/src/manual.html.luan
diffstat 2 files changed, 37 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
diff -r 90b93790c544 -r 6c00b8a59240 core/src/luan/modules/Binary.luan
--- a/core/src/luan/modules/Binary.luan	Sun Jul 05 18:26:04 2015 -0600
+++ b/core/src/luan/modules/Binary.luan	Sun Jul 05 19:29:56 2015 -0600
@@ -1,10 +1,11 @@
 java()
 local BinaryLuan = require "java:luan.modules.BinaryLuan"
 
+
 local M = {}
 
+M.binary = BinaryLuan.binary
 M.byte = BinaryLuan.byte_
-M.binary = BinaryLuan.binary
 M.to_string = BinaryLuan.to_string
 
 return M
diff -r 90b93790c544 -r 6c00b8a59240 website/src/manual.html.luan
--- 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 (&middot;&middot;&middot;)</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&nbsp;1;
+the default value for <code>j</code> is&nbsp;<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>.
+