summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Resources/DefaultContent/Libraries/json4lua/README.md52
-rw-r--r--Resources/DefaultContent/Libraries/json4lua/doc/INSTALL.txt4
-rw-r--r--Resources/DefaultContent/Libraries/json4lua/doc/LICENCE.txt21
-rw-r--r--Resources/DefaultContent/Libraries/json4lua/doc/README.txt5
-rw-r--r--Resources/DefaultContent/Libraries/json4lua/doc/VERSION.txt4
-rw-r--r--Resources/DefaultContent/Libraries/json4lua/doc/cgilua_patch.html187
-rw-r--r--Resources/DefaultContent/Libraries/json4lua/doc/index.html394
-rw-r--r--Resources/DefaultContent/Libraries/json4lua/doc/pics/json4lua.gifbin0 -> 5023 bytes
-rw-r--r--Resources/DefaultContent/Libraries/json4lua/doc/pics/lunartone.gifbin0 -> 312 bytes
-rw-r--r--Resources/DefaultContent/Libraries/json4lua/examples/example.lua23
-rw-r--r--Resources/DefaultContent/Libraries/json4lua/examples/jsonrpc.lua21
-rw-r--r--Resources/DefaultContent/Libraries/json4lua/examples/tests.lua223
-rw-r--r--Resources/DefaultContent/Libraries/json4lua/examples/timetrials.lua46
-rw-r--r--Resources/DefaultContent/Libraries/json4lua/json/json.lua427
-rw-r--r--Resources/DefaultContent/Libraries/json4lua/json/rpc.lua107
-rw-r--r--Resources/DefaultContent/Libraries/json4lua/json/rpcserver.lua78
-rw-r--r--Resources/DefaultContent/Libraries/json4lua/json4lua-1.0.0-1.rockspec32
-rw-r--r--Resources/DefaultContent/Libraries/lbase64/.gitignore3
-rw-r--r--Resources/DefaultContent/Libraries/lbase64/.travis.yml25
-rw-r--r--Resources/DefaultContent/Libraries/lbase64/README.md48
-rw-r--r--Resources/DefaultContent/Libraries/lbase64/base64.lua201
-rw-r--r--Resources/DefaultContent/Libraries/lbase64/bench.lua76
-rw-r--r--Resources/DefaultContent/Libraries/lbase64/rockspec/base64-1.5-1.rockspec20
-rw-r--r--Resources/DefaultContent/Libraries/lbase64/rockspec/base64-1.5-2.rockspec20
-rw-r--r--Resources/DefaultContent/Libraries/lbase64/rockspec/base64-1.5-3.rockspec20
-rw-r--r--Resources/DefaultContent/Libraries/lbase64/test.lua47
-rw-r--r--Resources/DefaultContent/Libraries/md5.lua/.travis.yml34
-rw-r--r--Resources/DefaultContent/Libraries/md5.lua/CHANGELOG.md5
-rw-r--r--Resources/DefaultContent/Libraries/md5.lua/MIT-LICENSE.txt20
-rw-r--r--Resources/DefaultContent/Libraries/md5.lua/README.md62
-rw-r--r--Resources/DefaultContent/Libraries/md5.lua/md5.lua396
-rw-r--r--Resources/DefaultContent/Libraries/md5.lua/rockspecs/md5-1.0-0.rockspec21
-rw-r--r--Resources/DefaultContent/Libraries/md5.lua/rockspecs/md5-1.0-1.rockspec21
-rw-r--r--Resources/DefaultContent/Libraries/md5.lua/rockspecs/md5-1.0-2.rockspec21
-rw-r--r--Resources/DefaultContent/Libraries/md5.lua/rockspecs/md5-1.1-0.rockspec21
-rw-r--r--Resources/DefaultContent/Libraries/md5.lua/spec/md5_spec.lua40
-rw-r--r--Resources/Libraries/LuaPanda/README.txt1
-rw-r--r--Resources/boot.lua4
38 files changed, 2728 insertions, 2 deletions
diff --git a/Resources/DefaultContent/Libraries/json4lua/README.md b/Resources/DefaultContent/Libraries/json4lua/README.md
new file mode 100644
index 0000000..b4f8015
--- /dev/null
+++ b/Resources/DefaultContent/Libraries/json4lua/README.md
@@ -0,0 +1,52 @@
+# json4lua
+JSON and JSONRPC for Lua
+
+# Installation #
+```
+luarocks install --server=http://rocks.moonscript.org/manifests/amrhassan --local json4Lua
+```
+
+# JSON Usage #
+
+## Encoding ##
+
+```lua
+json = require('json')
+print(json.encode({ 1, 2, 'fred', {first='mars',second='venus',third='earth'} }))
+```
+```json
+[1,2,"fred", {"first":"mars","second":"venus","third":"earth"}]
+```
+
+## Decoding ##
+
+```lua
+json = require("json")
+testString = [[ { "one":1 , "two":2, "primes":[2,3,5,7] } ]]
+decoded = json.decode(testString)
+table.foreach(decoded, print)
+print ("Primes are:")
+table.foreach(decoded.primes,print)
+```
+```
+one 1
+two 2
+primes table: 0032B928
+Primes are:
+1 2
+2 3
+3 5
+4 7
+```
+
+# JSONRPC Usage #
+```lua
+json = require('json')
+require("json.rpc")
+server = json.rpc.proxy("http://jsolait.net/testj.py")
+result, error = server.echo('Test echo!')
+print(result)
+```
+```
+Test echo!
+```
diff --git a/Resources/DefaultContent/Libraries/json4lua/doc/INSTALL.txt b/Resources/DefaultContent/Libraries/json4lua/doc/INSTALL.txt
new file mode 100644
index 0000000..3e7cad3
--- /dev/null
+++ b/Resources/DefaultContent/Libraries/json4lua/doc/INSTALL.txt
@@ -0,0 +1,4 @@
+INSTALLATION
+============
+
+See INSTALLATION section in doc/index.html \ No newline at end of file
diff --git a/Resources/DefaultContent/Libraries/json4lua/doc/LICENCE.txt b/Resources/DefaultContent/Libraries/json4lua/doc/LICENCE.txt
new file mode 100644
index 0000000..48f61e7
--- /dev/null
+++ b/Resources/DefaultContent/Libraries/json4lua/doc/LICENCE.txt
@@ -0,0 +1,21 @@
+The MIT License
+
+Copyright (c) 2009 Craig Mason-Jones
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE. \ No newline at end of file
diff --git a/Resources/DefaultContent/Libraries/json4lua/doc/README.txt b/Resources/DefaultContent/Libraries/json4lua/doc/README.txt
new file mode 100644
index 0000000..59e5b7b
--- /dev/null
+++ b/Resources/DefaultContent/Libraries/json4lua/doc/README.txt
@@ -0,0 +1,5 @@
+===================================================================================================================
+== README.txt
+===================================================================================================================
+
+Please see doc/index.html
diff --git a/Resources/DefaultContent/Libraries/json4lua/doc/VERSION.txt b/Resources/DefaultContent/Libraries/json4lua/doc/VERSION.txt
new file mode 100644
index 0000000..deae881
--- /dev/null
+++ b/Resources/DefaultContent/Libraries/json4lua/doc/VERSION.txt
@@ -0,0 +1,4 @@
+JSON4Lua and JSONRPC4Lua
+Version 1.0.0
+4 March 2015
+http://github.com/craigmj/json4lua/ \ No newline at end of file
diff --git a/Resources/DefaultContent/Libraries/json4lua/doc/cgilua_patch.html b/Resources/DefaultContent/Libraries/json4lua/doc/cgilua_patch.html
new file mode 100644
index 0000000..1b4d6b3
--- /dev/null
+++ b/Resources/DefaultContent/Libraries/json4lua/doc/cgilua_patch.html
@@ -0,0 +1,187 @@
+<html>
+<head>
+<title>JSON4Lua and JSONRPC4Lua</title>
+<style type="text/css">
+body {
+ font-family: Arial, Helvetica, Geneva;
+ font-size: 10pt;
+}
+
+.copyright {
+ color: #999999;
+ font-size: 8pt;
+ text-align:center;
+}
+
+.navBar {
+ border-left: 1px solid lightgray;
+ border-right: 1px solid lightgray;
+ border-bottom: 1px solid lightgray;
+ margin-top:5px;
+ margin-bottom: 5px;
+}
+.navBar h1 {
+ background-image: url('pics/lunartone.gif');
+ background-color: #e0c088;
+ color: white;
+ font-size: 9pt;
+ margin: 0px;
+ padding: 4px;
+}
+
+.navBar .navItem a {
+ color: #999999;
+ font-size: 8pt;
+ padding: 2px 2px 2px 10px;
+ text-decoration:none;
+}
+
+.navBar .navItem a:hover {
+ color: #ff9900;
+ text-decoration: underline;
+}
+
+.titleBar {
+ border-bottom: 2px dotted gray;
+ font-size: 20pt;
+ font-weight: bold;
+ margin-bottom: 15px;
+ width: 100%;
+}
+
+.workArea {
+ border: 1px none lightgray;
+ font-family: Times New Roman;
+ padding: 8px;
+ padding-left: 15px;
+}
+
+.workArea a {
+ font-weight: bold;
+ text-decoration: none;
+}
+
+.workArea a:hover {
+ color: #ff9900;
+ text-decoration: underline;
+}
+
+.workArea .downloadTable {
+ border: 1px solid lightgray;
+ padding: 0px;
+ margin: 0px;
+}
+
+.workArea .downloadTable * th {
+ background-color: #e0c088;
+ background-image: url('pics/lunartone.gif');
+ color: white;
+}
+
+.workArea .downloadTable * tr {
+ border: 1px solid lightgray;
+}
+
+.workArea .downloadTable * td {
+ vertical-align: top;
+}
+
+.workArea * dt {
+ font-size: 12pt;
+ margin-top: 10px;
+}
+
+.workArea * .example {
+ background-color: #ffffcc;
+ border: 1px dashed lightgray;
+ padding: 10px;
+}
+
+.workArea h1 {
+ font-size: 16pt;
+ font-weight: bold;
+}
+
+.workArea h2 {
+ font-size: 14pt;
+ font-weight: normal;
+ color: gray;
+}
+
+</style>
+<body>
+<table border="0">
+ <tr>
+ <td valign="top">
+ <img src="pics/json4lua.gif"><p/>
+ <!-- NAVIGATION BARS -->
+
+ <div class="navBar">
+ <h1>Home Page</h1>
+ <div class="navItem"><a href="index.html#news">Latest News</a></div>
+ <div class="navItem"><a href="index.html#introduction">Introduction</a></div>
+ <div class="navItem"><a href="index.html#licence">Licence</a></div>
+ <div class="navItem"><a href="index.html#requirements">Requirements</a></div>
+ <div class="navItem"><a href="index.html#download">Download</a></div>
+ <div class="navItem"><a href="index.html#installation">Installation</a></div>
+ <div class="navItem"><a href="index.html#usage">Usage &amp; Reference</a></div>
+ <div class="navItem"><a href="index.html#roadmap">History &amp; Roadmap</a></div>
+ </div> <!-- end of navigation bar: This Site -->
+
+ <div class="navBar">
+ <h1>json.luaforge</h1>
+ <div class="navItem"><a href="http://luaforge.net/projects/json/">Summary</a></div>
+ <div class="navItem"><a href="http://luaforge.net/forum/?group_id=143">Forums</a></div>
+ <div class="navItem"><a href="http://luaforge.net/tracker/?group_id=143">Tracker</a></div>
+ <div class="navItem"><a href="http://luaforge.net/news/?group_id=143">News</a></div>
+ <!--<div class="navItem"><a href="http://luaforge.net/scm/?group_id=143">CVS</a></div>-->
+ <div class="navItem"><a href="http://luaforge.net/frs/?group_id=143">Files</a></div>
+ </div> <!-- end of navigation bar: json.luaforge -->
+
+ <div class="navBar">
+ <h1>Lua</h1>
+ <div class="navItem"><a href="http://www.lua.org/">Lua</a></div>
+ <div class="navItem"><a href="http://www.luaforge.net/">Lua Forge</a></div>
+ <div class="navItem"><a href="http://www.keplerproject.org/cgilua/">CGI Lua</a></div>
+ <div class="navItem"><a href="http://www.keplerproject.org/compat/">Lua compat-5.1</a></div>
+ <div class="navItem"><a href="http://www.cs.princeton.edu/~diego/professional/luasocket/">Lua Socket 2.0</a></div>
+ <div class="navItem"><a href="http://www.keplerproject.org/xavante/">Xavante</a></div>
+ </div> <!-- end of navigation bar: Lua Resources -->
+
+ <div class="navBar">
+ <h1>JSON</h1>
+ <div class="navItem"><a href="http://www.json.org/">json.org</a></div>
+ <div class="navItem"><a href="http://www.json-rpc.org/">json-rpc.org</a></div>
+ </div> <!-- end of navigation bar: Lua Resources -->
+
+ </td>
+ <!-- MAIN WORK AREA -->
+ <td valign="top" class="workArea">
+ <div class="titleBar">Patching CGILua to handle <code>text/plain</code></div>
+
+ <!-- cgilua_patch.html -->
+JSON RPC (both the JSONRPC4Lua implementation and the <a href="http://www.jsolait.net/">jsolait Javascript</a> implementation) send the http request with a Content-Type of <code>text/plain</code>.<p/>
+
+CGILua 5.0 does not accept <code>text/plain</code> content, and will generate an error of 'Unsupported Media Type: text/plain'.<p/>
+
+This is easily patched in CGILua 5.0 by making the following change to <code>cgilua/post.lua</code>, line 286:<p/>
+Change:<pre>
+ elseif strfind (contenttype, "text/xml") then
+</pre>
+to
+<pre>
+ elseif strfind (contenttype, "text/xml") or strfind (contenttype, "text/plain") then
+</pre>
+This makes CGILua handle <code>text/plain</code> as it does <code>text/xml</code>, without parsing the incoming POST data.<p/>
+
+<b>Please note:</b> I have requested the maintainers of CGILua to make this change to CGILua, whereafter this patch will no longer be required.
+
+
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" class="copyright">&copy; 2005 Craig Mason-Jones</td>
+ </tr>
+</table>
+</body>
+</html> \ No newline at end of file
diff --git a/Resources/DefaultContent/Libraries/json4lua/doc/index.html b/Resources/DefaultContent/Libraries/json4lua/doc/index.html
new file mode 100644
index 0000000..12ec6c7
--- /dev/null
+++ b/Resources/DefaultContent/Libraries/json4lua/doc/index.html
@@ -0,0 +1,394 @@
+<html>
+<head>
+<title>JSON4Lua and JSONRPC4Lua</title>
+<style type="text/css">
+body {
+ font-family: Arial, Helvetica, Geneva;
+ font-size: 10pt;
+}
+
+.copyright {
+ color: #999999;
+ font-size: 8pt;
+ text-align:center;
+}
+
+.navBar {
+ border-left: 1px solid lightgray;
+ border-right: 1px solid lightgray;
+ border-bottom: 1px solid lightgray;
+ margin-top:5px;
+ margin-bottom: 5px;
+}
+.navBar h1 {
+ background-image: url('pics/lunartone.gif');
+ background-color: #e0c088;
+ color: white;
+ font-size: 9pt;
+ margin: 0px;
+ padding: 4px;
+}
+
+.navBar .navItem a {
+ color: #999999;
+ font-size: 8pt;
+ padding: 2px 2px 2px 10px;
+ text-decoration:none;
+}
+
+.navBar .navItem a:hover {
+ color: #ff9900;
+ text-decoration: underline;
+}
+
+.titleBar {
+ border-bottom: 2px dotted gray;
+ font-size: 20pt;
+ font-weight: bold;
+ margin-bottom: 15px;
+ width: 100%;
+}
+
+.workArea {
+ border: 1px none lightgray;
+ font-family: Times New Roman;
+ padding: 8px;
+ padding-left: 15px;
+}
+
+.workArea a {
+ font-weight: bold;
+ text-decoration: none;
+}
+
+.workArea a:hover {
+ color: #ff9900;
+ text-decoration: underline;
+}
+
+.workArea .downloadTable {
+ border: 1px solid lightgray;
+ padding: 0px;
+ margin: 0px;
+}
+
+.workArea .downloadTable * th {
+ background-color: #e0c088;
+ background-image: url('pics/lunartone.gif');
+ color: white;
+}
+
+.workArea .downloadTable * tr {
+ border: 1px solid lightgray;
+}
+
+.workArea .downloadTable * td {
+ vertical-align: top;
+}
+
+.workArea * dt {
+ font-size: 12pt;
+ margin-top: 10px;
+}
+
+.workArea * .example {
+ background-color: #ffffcc;
+ border: 1px dashed lightgray;
+ padding: 10px;
+}
+
+.workArea h1 {
+ font-size: 16pt;
+ font-weight: bold;
+}
+
+.workArea h2 {
+ font-size: 14pt;
+ font-weight: normal;
+ color: gray;
+}
+
+</style>
+<body>
+<table border="0">
+ <tr>
+ <td valign="top">
+ <img src="pics/json4lua.gif"><p/>
+ <!-- NAVIGATION BARS -->
+
+ <div class="navBar">
+ <h1>This Page</h1>
+ <div class="navItem"><a href="#news">Latest News</a></div>
+ <div class="navItem"><a href="#introduction">Introduction</a></div>
+ <div class="navItem"><a href="#licence">Licence</a></div>
+ <div class="navItem"><a href="#requirements">Requirements</a></div>
+ <div class="navItem"><a href="#download">Download</a></div>
+ <div class="navItem"><a href="#installation">Installation</a></div>
+ <div class="navItem"><a href="#usage">Usage &amp; Reference</a>
+ <div class="navItem" style="margin-left: 4px"><a href="#json_decode">decode</a></div>
+ <div class="navItem" style="margin-left: 4px"><a href="#json_encode">encode</a></div>
+ <div class="navItem" style="margin-left: 4px"><a href="#json_null">null</a></div>
+ <div class="navItem" style="margin-left: 4px"><a href="#json_rpc_call">rpc.call</a></div>
+ <div class="navItem" style="margin-left: 4px"><a href="#json_rpc_proxy">rpc.proxy</a></div>
+ <div class="navItem" style="margin-left: 4px"><a href="#json_rpcserver_serve">rpcserver.serve</a></div>
+
+ </div>
+ <div class="navItem"><a href="#roadmap">History &amp; Roadmap</a></div>
+ </div> <!-- end of navigation bar: This Site -->
+
+ <div class="navBar">
+ <h1>json.luaforge</h1>
+ <div class="navItem"><a href="http://luaforge.net/projects/json/">Summary</a></div>
+ <div class="navItem"><a href="http://luaforge.net/forum/?group_id=143">Forums</a></div>
+ <div class="navItem"><a href="http://luaforge.net/tracker/?group_id=143">Tracker</a></div>
+ <div class="navItem"><a href="http://luaforge.net/news/?group_id=143">News</a></div>
+ <!--<div class="navItem"><a href="http://luaforge.net/scm/?group_id=143">CVS</a></div>-->
+ <div class="navItem"><a href="http://luaforge.net/frs/?group_id=143">Files</a></div>
+ </div> <!-- end of navigation bar: json.luaforge -->
+
+ <div class="navBar">
+ <h1>Lua</h1>
+ <div class="navItem"><a href="http://www.lua.org/">Lua</a></div>
+ <div class="navItem"><a href="http://www.luaforge.net/">Lua Forge</a></div>
+ <div class="navItem"><a href="http://www.keplerproject.org/cgilua/">CGI Lua</a></div>
+ <div class="navItem"><a href="http://www.keplerproject.org/compat/">Lua compat-5.1</a></div>
+ <div class="navItem"><a href="http://www.cs.princeton.edu/~diego/professional/luasocket/">Lua Socket 2.0</a></div>
+ <div class="navItem"><a href="http://www.keplerproject.org/xavante/">Xavante</a></div>
+ </div> <!-- end of navigation bar: Lua Resources -->
+
+ <div class="navBar">
+ <h1>JSON</h1>
+ <div class="navItem"><a href="http://www.json.org/">json.org</a></div>
+ <div class="navItem"><a href="http://www.json-rpc.org/">json-rpc.org</a></div>
+ </div> <!-- end of navigation bar: Lua Resources -->
+
+ </td>
+ <!-- MAIN WORK AREA -->
+ <td valign="top" class="workArea">
+ <div class="titleBar">JSON4Lua and JSONRPC4Lua</div>
+ <!-- ***************** LATEST NEWS ***************** -->
+ <h1><a name="news"></a>Latest News</h1>
+ <p><small>(2009-08-06)</small> We've changed the JSON4Lua and JSONRPC4Lua licence from the GPL to the MIT licence, like Lua itself.</p>
+ <p>
+ The 0.9.20 release fixes a bug in Lua 5.1 operation, introduces a <a href="#json_null"><code>json.null</code></a> value to force null values in JSON encodings, improves performance (over 50% faster on some tests), and permits <code>/* comments */</code> in the JSON string being decoded.
+ </p>
+
+ <!-- ***************** INTRODUCTION ***************** -->
+ <h1><a name="introduction"></a>Introduction</h1>
+ JSON4Lua and JSONRPC4Lua implement <a href="http://www.json.org">JSON (JavaScript Object Notation)</a> encoding and decoding and a <a href="http://www.json-rpc.org/">JSON-RPC-over-http</a> client for <a href="http://www.lua.org/">Lua</a>.<p/>
+
+JSON is JavaScript Object Notation, a simple encoding of Javascript-like objects that is ideal for lightweight transmission of relatively weakly-typed data.
+A sub-package of JSON4Lua is JSONRPC4Lua, which provides a simple JSON-RPC-over-http client and server (in a CGILua environment) for Lua. Please seen the documentation below for JSONRPC4Lua.
+
+ <!-- ***************** LICENCE ***************** -->
+ <h1><a name="licence"></a>Licence</h1>
+ JSON4Lua is licensed under the MIT Consortium licence like Lua itself. Please see <a href="LICENCE.txt">LICENCE.txt</a> for details.<p/>
+
+ <!-- ***************** REQUIREMENTS ***************** -->
+ <a name="requirements"></a><h1>Requirements</h1>
+ JSON4Lua is a pure-Lua module that is Lua 5.0 compatible (if you have <a href="http://www.keplerproject.org/compat/">compat-5.1</a> for Lua 5.0). JSON4Lua also works (perfectly, I hope) under Lua 5.1, which is where I largely use it nowadays. Since Lua is platform independent, so is JSON4Lua.<p/>
+
+ The JSON4RPC sub-module requires <a href="http://www.cs.princeton.edu/~diego/professional/luasocket/">Lua Socket 2.0</a>. It uses <code>socket.http</code> for for the RPC over http connection. Socket 2.0 includes <code>ltn12</code>, which is also used by JSON4RPC.<p />
+
+ To use <code>json.rpcserver</code> you need a <a href="http://www.keplerproject.org/cgilua/">CGILua</a> enabled webserver. However, a quick <a href="cgilua_patch.html">patch</a> is required in CGILua 5.0 to support JSON-RPC.
+
+ <!-- ***************** START OF DOWNLOAD SECTION ***************** -->
+ <h1><a name="download"></a>Download</h1>
+ JSON4Lua is hosted on <a href="http://www.luaforge.net">LuaForge</a>.
+ <table cols="2" class="downloadTable">
+ <tr><th>Version</th><th>Date</th><th>Notes</th></tr>
+ <tr><td><a href="http://luaforge.net/frs/?group_id=143">0.9.30</a></td><td>6 August 2009</td><td>
+ Changed to MIT Licence.
+ </td></tr>
+ <tr><td><a href="http://luaforge.net/frs/?group_id=143">0.9.20</a></td><td>4 January 2006</td><td>
+ Introduction of local Lua functions for private functions (removed _ function prefix). <br />
+ Fixed Lua 5.1 compatibility issues.<br />
+ Introduced <code>json.null</code> to have null values in associative arrays.<br />
+ Performance improvement (more than 50% on some tests) through <code>table.concat</code> rather than <code>..</code> operator.<br/>
+ <code>json.decode</code> now ignores <code>/* */</code> comments in the JSON string.<br />
+ </td></tr>
+ <tr><td><a href="http://luaforge.net/frs/?group_id=143">0.9.10</a></td><td>20 December 2005</td><td>
+ Fixes bug with array representation when nil / null values occur in the array.<br />
+ Adds content-type header of <code>text/plain</code> to JSON RPC http requests.<br />
+ Introduces <code>json.rpcserver</code> module with simple JSON RPC enablement for Lua objects.<br />
+ Moved the <code>json.lua</code> file into the <code>json</code> directory. Ensure, therefore, that your <code>LUA_PATH</code> contains a module-finding form like <code>LUA_PATH = c:\proj\lua\?\?.lua;?.lua</code>.<br/>
+ </td></tr>
+ <tr>
+ <td><a href="http://luaforge.net/frs/?group_id=143">0.9.01</a></td>
+ <td>19 December 2005</td>
+ <td>Minor corrections to documentation.</td>
+ </tr>
+ <tr>
+ <td><a href="http://luaforge.net/frs/?group_id=143">0.9.00</a></td>
+ <td>19 December 2005</td>
+ <td>First release</td>
+ </tr>
+ </table>
+ <!-- END OF DOWNLOAD SECTION -->
+
+ <!-- ***************** START OF INSTALLATION SECTION ***************** -->
+ <h1><a name="installation"></a>Installation</h1>
+ As of version 0.9.10, all the JSON4Lua files are contained in the <code>json</code> subdirectory in the distribution zip.<p />
+ Simply copy the <code>json</code> subdirectory so that it is in your Lua path.<p />
+ Ensure that your <code>LUA_PATH</code> variable permits module resolution of the form <code>?/?.lua</code>.<p />
+ <b>Example</b>
+ <div class="example">
+ </div>
+ <h2>Using Windows</h2>
+ Under Windows, set your Lua path as (my Lua installation is in <code>c:\proj\lua\</code>): <p/>
+ <code>
+ set LUA_PATH=c:\proj\lua\?.lua;c:\proj\lua\?\?.lua;?.lua
+ </code><p/>
+ For compat-5.1.lua to start when Lua starts (if you're using Lua 5.0), you also need:<p/>
+ <code>
+ set LUA_INIT=@c:\proj\lua\compat-5.1.lua
+ </code><p />
+ You probably also want to set your library path:<p/>
+ <code>set LUA_CPATH=c:\proj\lua\lib\?.dll;?.dll</code>
+
+ <!------------------------ USAGE AND REFERENCE -------------------->
+ <h1><a name="usage"></a>Usage &amp; Reference</h1>
+ The following functions in <b>JSON4Lua</b> and <b>JSONRPC4Lua</b> are of interest:<p />
+ <dl>
+ <dt><a name="json_encode"></a><code>string <b>json.encode</b>( lua_object )</code></dt>
+ <dd>Returns the Lua object JSON encoded into a string.<p/>
+ <b>Example</b>
+ <div class="example">
+ <code>
+ json = require("json")<br/>
+ print (json.encode( { 1, 2, 'fred', {first='mars',second='venus',third='earth'} } ))
+ </code><p/>
+ prints<p/><code> [1,2,"fred", {"first":"mars","second":"venus","third","earth"}]</code>
+ </div>
+
+ </dd>
+ <dt><a name="json_decode"></a><code>lua_object <b>json.decode</b>( json_string )</code></dt>
+ <dd>Decodes the JSON encoded data structure, and returns a Lua object with the appropriate data.<p/>
+ <b>Example</b>
+
+ <div class="example">
+ <code>
+ json = require("json")<br/>
+
+ testString = [[ { "one":1 , "two":2, "primes":[2,3,5,7] } ]]<br/>
+ o = json.decode(testString)<br/>
+ table.foreach(o,print)<br />
+ print ("Primes are:")<br />
+ table.foreach(o.primes,print)
+ </code><p/>
+ prints:<p/>
+ <pre>
+one 1
+two 2
+primes table: 0032B928
+Primes are:
+1 2
+2 3
+3 5
+4 7</pre>
+ </div></dd>
+
+ <dt><a name="json_null"></a><code><b>json.null</b></code></dt>
+ <dd>Returns a unique value that will be encoded as a <code>null</code> in a JSON encoding.
+ <p>This is necessary in one situation. In Lua, if a key in a table has a <code>nil</code> value, the key is simply discarded (since any non-existent key has a nil value). The encoding of arrays has been built to manage this nil-values in arrays, but associative arrays provide a problem. Consider:
+ <div class="example"><pre>t = { user="test", password=nil }</pre></div>
+ Since Lua simply discards the <code>password</code> key, JSON4Lua encodes this as the JSON string
+ <div class="example"><pre>{"user":"test"}</pre></div>
+ If, for some reason, your JSON RPC Server requires a defined <code>null</code> value, use the following code:
+ <div class="example"><pre>t = { user="test", password=json.null }</pre></div>
+ This will now correctly encode to:
+ <div class="example"><pre>{"user":"test","password":null}</pre></div>
+ Incidentally, <code>json.null</code> is simply a function that returns itself, so that you can use either <code>json.null</code> or <code>json.null()</code> as you fancy.
+ </dd>
+
+
+ <dt><a name="json_rpc_call"></a><code>result, error <b>json.rpc.call</b> ( url, method, ...)</code></dt>
+ <dd>Calls the named method on the given url with the arg parameters. Returns the result and the error. If <code>error</code> is <code>nil</code>, no error occurred.<p/>
+ <b>Example</b>
+ <div class="example">
+ <pre>require ("json.rpc")
+result, error = json.rpc.call("http://jsolait.net/testj.py","echo","Test echo!")
+print(result)</pre>
+ <p />prints<p />
+ <pre>Test echo!</pre>
+ </div>
+ </dd>
+ <dt><a name="json_rpc_proxy"></a><code>proxyServer = <b>json.rpc.proxy</b> (url)</code></dt>
+ <dd>Creates a proxy server object on which JSON-RPC calls can be made. Each call will return the <code>result, error</code>. If <code>error</code> is <code>nil</code>, no error occurred.<p/>
+ <b>Example</b>
+ <div class="example">
+ <pre>
+require ("json.rpc")
+server = json.rpc.proxy("http://jsolait.net/testj.py")
+result, error = server.echo('Test echo!')
+print(result)</pre>
+ <p />prints<p />
+ <pre>Test echo!</pre>
+ </div>
+ </dd>
+
+ <dt><a name="json_rpcserver_serve"></a><code><b>json.rpcserver.serve</b>(object[, packReturn])</code></dt>
+ <dd>
+ Handles an incoming CGILua request as a JSON RPC request and serves the request from
+ the given object.
+ <p />The optional <code>packReturn</code> parameter, if set <code>true</code>, will, if the requested
+ method returns more than one value, pack these returned values into an array. If only a single value
+ is returned, it is not packed into an array. If <code>packReturn</code> is <code>false</code> (or not set), only the first
+ return value from the requested method will be returned. This is necessitated since the JSON protocol does not permit a method call to return more than a single value.
+ <p/>
+
+ <code>serve</code> returns nothing.<p/>
+
+ <b>Example</b>
+ <div class="example">
+ <pre>
+--
+-- jsonrpc.lua
+-- Installed in a CGILua webserver environment (with necessary CGI Lua 5.0 patch)
+--
+require ('json.rpcserver')
+
+-- The Lua class that is to serve JSON RPC requests
+local myServer = {
+ echo = function (msg) return msg end,
+ average = function(...)
+ local total=0
+ local count=0
+ for i=1, table.getn(arg) do
+ total = total + arg[i]
+ count = count + 1
+ end
+ return { average= total/count, sum = total, n=count }
+ end
+}
+
+json.rpcserver.serve(myServer)
+</pre>
+An example of using this JSON RPC server from a Lua file:
+<pre>
+require ('json.rpc')
+local server = json.rpc.proxy('http://www.myserver.com/jsonrpc.lua')
+table.foreach(server.average(10,15,23), print)
+</pre>
+Prints:
+<pre>
+average 16
+sum 48
+n 3
+</pre>
+ </div>
+
+ </dd>
+ </dl>
+
+ <!-- ***************** HISTORY AND ROADMAP ***************** -->
+ <h1><a name="roadmap"></a>History &amp; Roadmap</h1>
+ The downloads sections details the versions and their related histories. I will wait for Lua 5.1 to be final (expected late January) before making the JSON4Lua module beta. If no serious bugs or objections are encountered, I will make the module 1.0 on 1 April 2006 (to coincide with April Fool's day!)
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" class="copyright">&copy; 2005, 2006 Craig Mason-Jones</td>
+ </tr>
+</table>
+</body>
+</html> \ No newline at end of file
diff --git a/Resources/DefaultContent/Libraries/json4lua/doc/pics/json4lua.gif b/Resources/DefaultContent/Libraries/json4lua/doc/pics/json4lua.gif
new file mode 100644
index 0000000..938bcb9
--- /dev/null
+++ b/Resources/DefaultContent/Libraries/json4lua/doc/pics/json4lua.gif
Binary files differ
diff --git a/Resources/DefaultContent/Libraries/json4lua/doc/pics/lunartone.gif b/Resources/DefaultContent/Libraries/json4lua/doc/pics/lunartone.gif
new file mode 100644
index 0000000..e914a8f
--- /dev/null
+++ b/Resources/DefaultContent/Libraries/json4lua/doc/pics/lunartone.gif
Binary files differ
diff --git a/Resources/DefaultContent/Libraries/json4lua/examples/example.lua b/Resources/DefaultContent/Libraries/json4lua/examples/example.lua
new file mode 100644
index 0000000..36497da
--- /dev/null
+++ b/Resources/DefaultContent/Libraries/json4lua/examples/example.lua
@@ -0,0 +1,23 @@
+--[[
+JSON4Lua example script.
+Demonstrates the simple functionality of the json module.
+]]--
+json = require('json')
+
+
+-- Object to JSON encode
+test = {
+ one='first',two='second',three={2,3,5}
+}
+
+jsonTest = json.encode(test)
+
+print('JSON encoded test is: ' .. jsonTest)
+
+-- Now JSON decode the json string
+result = json.decode(jsonTest)
+
+print ("The decoded table result:")
+table.foreach(result,print)
+print ("The decoded table result.three")
+table.foreach(result.three, print)
diff --git a/Resources/DefaultContent/Libraries/json4lua/examples/jsonrpc.lua b/Resources/DefaultContent/Libraries/json4lua/examples/jsonrpc.lua
new file mode 100644
index 0000000..f265b8a
--- /dev/null
+++ b/Resources/DefaultContent/Libraries/json4lua/examples/jsonrpc.lua
@@ -0,0 +1,21 @@
+--
+-- jsonrpc.lua
+-- Installed in a CGILua webserver environment (with necessary CGI Lua 5.0 patch)
+--
+require ('json.rpcserver')
+
+-- The Lua class that is to serve JSON RPC requests
+local myServer = {
+ echo = function (msg) return msg end,
+ average = function(...)
+ local total=0
+ local count=0
+ for i=1, table.getn(arg) do
+ total = total + arg[i]
+ count = count + 1
+ end
+ return { average= total/count, sum = total, n=count }
+ end
+}
+
+json.rpcserver.serve(myServer) \ No newline at end of file
diff --git a/Resources/DefaultContent/Libraries/json4lua/examples/tests.lua b/Resources/DefaultContent/Libraries/json4lua/examples/tests.lua
new file mode 100644
index 0000000..2e58b6e
--- /dev/null
+++ b/Resources/DefaultContent/Libraries/json4lua/examples/tests.lua
@@ -0,0 +1,223 @@
+--[[
+Some basic tests for JSON4Lua.
+]]--
+
+--- Compares two tables for being data-identical.
+function compareData(a,b)
+ if (type(a)=='string' or type(a)=='number' or type(a)=='boolean' or type(a)=='nil') then return a==b end
+ -- After basic data types, we're only interested in tables
+ if (type(a)~='table') then return true end
+ -- Check that a has everything b has
+ for k,v in pairs(b) do
+ if (not compareData( a[k], v ) ) then return false end
+ end
+ for k,v in pairs(a) do
+ if (not compareData( v, b[k] ) ) then return false end
+ end
+ return true
+end
+
+---
+-- Checks that our compareData function works properly
+function testCompareData()
+ s = "name"
+ r = "name"
+ assert(compareData(s,r))
+ assert(not compareData('fred',s))
+ assert(not compareData(nil, s))
+ assert(not compareData("123",123))
+ assert(not compareData(false, nil))
+ assert(compareData(true, true))
+ assert(compareData({1,2,3},{1,2,3}))
+ assert(compareData({'one',2,'three'},{'one',2,'three'}))
+ assert(not compareData({'one',2,4},{4,2,'one'}))
+ assert(compareData({one='ichi',two='nichi',three='san'}, {three='san',two='nichi',one='ichi'}))
+ s = { one={1,2,3}, two={one='hitotsu',two='futatsu',three='mitsu'} }
+ assert(compareData(s,s))
+ t = { one={1,2,3}, two={one='een',two='twee',three='drie'} }
+ assert(not compareData(s,t))
+end
+
+testCompareData()
+
+--
+--
+-- Performs some perfunctory tests on JSON module
+function testJSON4Lua()
+ json = require('json')
+
+ if nil then
+ -- Test encodeString
+ s = [["\"
+]]
+ r = json._encodeString(s)
+ assert(r=='\\"\\\\\\"\\n')
+ s = [["""\\\"]]
+ r = json._encodeString(s)
+ assert(r==[[\"\"\"\\\\\\\"]])
+
+ end
+
+ -- Test encode for basic strings (complicated strings)
+ s = [[Hello, Lua!]]
+ r = json.encode(s)
+ assert(r=='"Hello, Lua!"')
+ s = [["\"
+]]
+ r = json.encode(s)
+ assert(r=='\"\\"\\\\\\"\\n\"')
+ s = [["""\\\"]]
+ r = json.encode(s)
+ assert(r==[["\"\"\"\\\\\\\""]])
+
+ -- Test encode for numeric values
+ s = 23
+ r = json.encode(s)
+ assert(r=='23')
+ s=48.123
+ r = json.encode(s)
+ assert(r=='48.123')
+
+ -- Test encode for boolean values
+ assert(json.encode(true)=='true')
+ assert(json.encode(false)=='false')
+ assert(json.encode(nil)=='null')
+
+ -- Test encode for arrays
+ s = {1,2,3}
+ r = json.encode(s)
+ assert(r=="[1,2,3]")
+ s = {9,9,9}
+ r = json.encode(s)
+ assert(r=="[9,9,9]")
+
+ -- Complex array test
+ s = { 2, 'joe', false, nil, 'hi' }
+ r = json.encode(s)
+ assert(r=='[2,"joe",false,null,"hi"]')
+
+ -- Test encode for tables
+ s = {Name='Craig',email='craig@lateral.co.za',age=35}
+ r = json.encode(s)
+ -- NB: This test can fail because of order: need to test further once
+ -- decoding is supported.
+ -- assert(r==[[{"age":35,"Name":"Craig","email":"craig@lateral.co.za"}]])
+
+ -- Test encoding tables with numeric (string) indexes
+ s = {}
+ s['1']='One'
+ r = json.encode(s)
+ -- print("r = ", r)
+ assert(r=='{"1":"One"}')
+
+ s['2']= {One='Uno'}
+ r = json.encode(s)
+ assert(compareData(json.decode(r), s))
+
+ -- Test decode_scanWhitespace
+ if nil then
+ s = " \n \r \t "
+ e = json._decode_scanWhitespace(s,1)
+ assert(e==string.len(s)+1)
+ s = " \n\r\t4"
+ assert(json._decode_scanWhitespace(s,1)==5)
+
+ -- Test decode_scanString
+ s = [["Test"]]
+ r,e = json._decode_scanString(s,1)
+ assert(r=='Test' and e==7)
+ s = [["This\nis a \"test"]]
+ r = json._decode_scanString(s,1)
+ assert(r=="This\nis a \"test")
+
+ s = [["Test\u00A7\\"]]
+ r,e = json._decode_scanString(s,1)
+ assert(r=="Test\xC2\xA7\\" and e==9)
+
+ -- Test decode_scanNumber
+ s = [[354]]
+ r,e = json._decode_scanNumber(s,1)
+ assert(r==354 and e==4)
+ s = [[ 4565.23 AND OTHER THINGS ]]
+ r,e = json._decode_scanNumber(s,2)
+ assert(r==4565.23 and e==9)
+ s = [[ -23.22 and ]]
+ r,e = json._decode_scanNumber(s,2)
+ assert(r==-23.22 and e==8)
+
+ -- Test decode_scanConstant
+ s = "true"
+ r,e = json._decode_scanConstant(s,1)
+ assert(r==true and e==5)
+ s = " false "
+ r,e = json._decode_scanConstant(s,3)
+ assert(r==false and e==8)
+ s = "1null6"
+ r,e = json._decode_scanConstant(s,2)
+ assert(r==nil and e==6)
+
+ -- Test decode_scanArray
+ s = "[1,2,3]"
+ r,e = json._decode_scanArray(s,1)
+ assert(compareData(r,{1,2,3}))
+ s = [[[ 1 , 3 ,5 , "Fred" , true, false, null, -23 ] ]]
+ r,e = json._decode_scanArray(s,1)
+ assert(compareData(r, {1,3,5,'Fred',true,false,nil,-23} ) )
+ s = "[3,5,null,7,9]"
+ r,e = json._decode_scanArray(s,1)
+ assert(compareData(r, {3,5,nil,7,9}))
+ s = "[3,5,null,7,9,null,null]"
+ r,e = json._decode_scanArray(s,1)
+ assert(compareData(r, {3,5,nil,7,9,nil,nil}))
+
+ end
+
+ s = [["Test\u00A7\\\""]]
+ r,e = json.decode(s)
+ assert(r=="Test\xC2\xA7\\\"", r)
+
+ -- Test decode_scanObject
+ s = [[ {"one":1, "two":2, "three":"three", "four":true} ]]
+ r,e = json.decode(s)
+ -- for x,y in pairs(r) do
+ -- print(x,y)
+ -- end
+ assert(compareData(r,{one=1,two=2,three='three',four=true}))
+ s = [[ { "one" : { "first":1,"second":2,"third":3}, "two":2, "three":false } ]]
+ r,e = json.decode(s)
+ assert(compareData(r, {one={first=1,second=2,third=3},two=2,three=false}))
+ s = [[ { "primes" : [2,3,5,7,9], "user":{"name":"craig","age":35,"programs_lua":true},
+ "lua_is_great":true } ]]
+ r,e = json.decode(s)
+ assert(compareData(r, {primes={2,3,5,7,9},user={name='craig',age=35,programs_lua=true},lua_is_great=true}))
+
+ -- Test json.null management
+ t = { 1,2,json.null,4 }
+ assert( json.encode(t)=="[1,2,null,4]" )
+ t = {x=json.null }
+ r = json.encode(t)
+ assert( json.encode(t) == '{"x":null}' )
+
+ -- Test comment decoding
+ s = [[ /* A comment
+ that spans
+ a few lines
+ */
+ "test"
+ ]]
+ r,e = json.decode(s)
+ assert(r=='test',"Comment decoding failed")
+
+ -- Per error reported by M.Hund, with incorrect decoding of string-numbered tables
+ s = {}
+ subt = {a="a",b="b",c="c"}
+ s['1'] = subt
+ s['2'] = subt
+ s['3'] = subt
+ r = json.decode('{"1":{"a":"a","b":"b","c":"c"},"2":{"a":"a","b":"b","c":"c"},"3":{"a":"a","b":"b","c":"c"}}')
+ assert(compareData(s, r))
+end
+
+testJSON4Lua()
+
+print("JSON4Lua tests completed successfully")
diff --git a/Resources/DefaultContent/Libraries/json4lua/examples/timetrials.lua b/Resources/DefaultContent/Libraries/json4lua/examples/timetrials.lua
new file mode 100644
index 0000000..cbda514
--- /dev/null
+++ b/Resources/DefaultContent/Libraries/json4lua/examples/timetrials.lua
@@ -0,0 +1,46 @@
+--[[
+ Some Time Trails for the JSON4Lua package
+]]--
+
+
+require('json')
+require('os')
+require('table')
+
+local t1 = os.clock()
+local jstr
+local v
+for i=1,100 do
+ local t = {}
+ for j=1,500 do
+ table.insert(t,j)
+ end
+ for j=1,500 do
+ table.insert(t,"VALUE")
+ end
+ jstr = json.encode(t)
+ v = json.decode(jstr)
+ --print(json.encode(t))
+end
+
+for i = 1,100 do
+ local t = {}
+ for j=1,500 do
+ local m= math.mod(j,3)
+ if (m==0) then
+ t['a'..j] = true
+ elseif m==1 then
+ t['a'..j] = json.null
+ else
+ t['a'..j] = j
+ end
+ end
+ jstr = json.encode(t)
+ v = json.decode(jstr)
+end
+
+print (jstr)
+--print(type(t1))
+local t2 = os.clock()
+
+print ("Elapsed time=" .. os.difftime(t2,t1) .. "s") \ No newline at end of file
diff --git a/Resources/DefaultContent/Libraries/json4lua/json/json.lua b/Resources/DefaultContent/Libraries/json4lua/json/json.lua
new file mode 100644
index 0000000..79761b6
--- /dev/null
+++ b/Resources/DefaultContent/Libraries/json4lua/json/json.lua
@@ -0,0 +1,427 @@
+-----------------------------------------------------------------------------
+-- JSON4Lua: JSON encoding / decoding support for the Lua language.
+-- json Module.
+-- Author: Craig Mason-Jones
+-- Homepage: http://github.com/craigmj/json4lua/
+-- Version: 1.0.0
+-- This module is released under the MIT License (MIT).
+-- Please see LICENCE.txt for details.
+--
+-- USAGE:
+-- This module exposes two functions:
+-- json.encode(o)
+-- Returns the table / string / boolean / number / nil / json.null value as a JSON-encoded string.
+-- json.decode(json_string)
+-- Returns a Lua object populated with the data encoded in the JSON string json_string.
+--
+-- REQUIREMENTS:
+-- compat-5.1 if using Lua 5.0
+--
+-- CHANGELOG
+-- 0.9.20 Introduction of local Lua functions for private functions (removed _ function prefix).
+-- Fixed Lua 5.1 compatibility issues.
+-- Introduced json.null to have null values in associative arrays.
+-- json.encode() performance improvement (more than 50%) through table.concat rather than ..
+-- Introduced decode ability to ignore /**/ comments in the JSON string.
+-- 0.9.10 Fix to array encoding / decoding to correctly manage nil/null values in arrays.
+-----------------------------------------------------------------------------
+
+-----------------------------------------------------------------------------
+-- Imports and dependencies
+-----------------------------------------------------------------------------
+local math = require('math')
+local string = require("string")
+local table = require("table")
+
+-----------------------------------------------------------------------------
+-- Module declaration
+-----------------------------------------------------------------------------
+local json = {} -- Public namespace
+local json_private = {} -- Private namespace
+
+-- Public constants
+json.EMPTY_ARRAY={}
+json.EMPTY_OBJECT={}
+
+-- Public functions
+
+-- Private functions
+local decode_scanArray
+local decode_scanComment
+local decode_scanConstant
+local decode_scanNumber
+local decode_scanObject
+local decode_scanString
+local decode_scanWhitespace
+local encodeString
+local isArray
+local isEncodable
+
+-----------------------------------------------------------------------------
+-- PUBLIC FUNCTIONS
+-----------------------------------------------------------------------------
+--- Encodes an arbitrary Lua object / variable.
+-- @param v The Lua object / variable to be JSON encoded.
+-- @return String containing the JSON encoding in internal Lua string format (i.e. not unicode)
+function json.encode (v)
+ -- Handle nil values
+ if v==nil then
+ return "null"
+ end
+
+ local vtype = type(v)
+
+ -- Handle strings
+ if vtype=='string' then
+ return '"' .. json_private.encodeString(v) .. '"' -- Need to handle encoding in string
+ end
+
+ -- Handle booleans
+ if vtype=='number' or vtype=='boolean' then
+ return tostring(v)
+ end
+
+ -- Handle tables
+ if vtype=='table' then
+ local rval = {}
+ -- Consider arrays separately
+ local bArray, maxCount = isArray(v)
+ if bArray then
+ for i = 1,maxCount do
+ table.insert(rval, json.encode(v[i]))
+ end
+ else -- An object, not an array
+ for i,j in pairs(v) do
+ if isEncodable(i) and isEncodable(j) then
+ table.insert(rval, '"' .. json_private.encodeString(i) .. '":' .. json.encode(j))
+ end
+ end
+ end
+ if bArray then
+ return '[' .. table.concat(rval,',') ..']'
+ else
+ return '{' .. table.concat(rval,',') .. '}'
+ end
+ end
+
+ -- Handle null values
+ if vtype=='function' and v==json.null then
+ return 'null'
+ end
+
+ assert(false,'encode attempt to encode unsupported type ' .. vtype .. ':' .. tostring(v))
+end
+
+
+--- Decodes a JSON string and returns the decoded value as a Lua data structure / value.
+-- @param s The string to scan.
+-- @param [startPos] Optional starting position where the JSON string is located. Defaults to 1.
+-- @param Lua object, number The object that was scanned, as a Lua table / string / number / boolean or nil,
+-- and the position of the first character after
+-- the scanned JSON object.
+function json.decode(s, startPos)
+ startPos = startPos and startPos or 1
+ startPos = decode_scanWhitespace(s,startPos)
+ assert(startPos<=string.len(s), 'Unterminated JSON encoded object found at position in [' .. s .. ']')
+ local curChar = string.sub(s,startPos,startPos)
+ -- Object
+ if curChar=='{' then
+ return decode_scanObject(s,startPos)
+ end
+ -- Array
+ if curChar=='[' then
+ return decode_scanArray(s,startPos)
+ end
+ -- Number
+ if string.find("+-0123456789.e", curChar, 1, true) then
+ return decode_scanNumber(s,startPos)
+ end
+ -- String
+ if curChar==[["]] or curChar==[[']] then
+ return decode_scanString(s,startPos)
+ end
+ if string.sub(s,startPos,startPos+1)=='/*' then
+ return json.decode(s, decode_scanComment(s,startPos))
+ end
+ -- Otherwise, it must be a constant
+ return decode_scanConstant(s,startPos)
+end
+
+--- The null function allows one to specify a null value in an associative array (which is otherwise
+-- discarded if you set the value with 'nil' in Lua. Simply set t = { first=json.null }
+function json.null()
+ return json.null -- so json.null() will also return null ;-)
+end
+-----------------------------------------------------------------------------
+-- Internal, PRIVATE functions.
+-- Following a Python-like convention, I have prefixed all these 'PRIVATE'
+-- functions with an underscore.
+-----------------------------------------------------------------------------
+
+--- Scans an array from JSON into a Lua object
+-- startPos begins at the start of the array.
+-- Returns the array and the next starting position
+-- @param s The string being scanned.
+-- @param startPos The starting position for the scan.
+-- @return table, int The scanned array as a table, and the position of the next character to scan.
+function decode_scanArray(s,startPos)
+ local array = {} -- The return value
+ local stringLen = string.len(s)
+ assert(string.sub(s,startPos,startPos)=='[','decode_scanArray called but array does not start at position ' .. startPos .. ' in string:\n'..s )
+ startPos = startPos + 1
+ -- Infinite loop for array elements
+ local index = 1
+ repeat
+ startPos = decode_scanWhitespace(s,startPos)
+ assert(startPos<=stringLen,'JSON String ended unexpectedly scanning array.')
+ local curChar = string.sub(s,startPos,startPos)
+ if (curChar==']') then
+ return array, startPos+1
+ end
+ if (curChar==',') then
+ startPos = decode_scanWhitespace(s,startPos+1)
+ end
+ assert(startPos<=stringLen, 'JSON String ended unexpectedly scanning array.')
+ object, startPos = json.decode(s,startPos)
+ array[index] = object
+ index = index + 1
+ until false
+end
+
+--- Scans a comment and discards the comment.
+-- Returns the position of the next character following the comment.
+-- @param string s The JSON string to scan.
+-- @param int startPos The starting position of the comment
+function decode_scanComment(s, startPos)
+ assert( string.sub(s,startPos,startPos+1)=='/*', "decode_scanComment called but comment does not start at position " .. startPos)
+ local endPos = string.find(s,'*/',startPos+2)
+ assert(endPos~=nil, "Unterminated comment in string at " .. startPos)
+ return endPos+2
+end
+
+--- Scans for given constants: true, false or null
+-- Returns the appropriate Lua type, and the position of the next character to read.
+-- @param s The string being scanned.
+-- @param startPos The position in the string at which to start scanning.
+-- @return object, int The object (true, false or nil) and the position at which the next character should be
+-- scanned.
+function decode_scanConstant(s, startPos)
+ local consts = { ["true"] = true, ["false"] = false, ["null"] = nil }
+ local constNames = {"true","false","null"}
+
+ for i,k in pairs(constNames) do
+ if string.sub(s,startPos, startPos + string.len(k) -1 )==k then
+ return consts[k], startPos + string.len(k)
+ end
+ end
+ assert(nil, 'Failed to scan constant from string ' .. s .. ' at starting position ' .. startPos)
+end
+
+--- Scans a number from the JSON encoded string.
+-- (in fact, also is able to scan numeric +- eqns, which is not
+-- in the JSON spec.)
+-- Returns the number, and the position of the next character
+-- after the number.
+-- @param s The string being scanned.
+-- @param startPos The position at which to start scanning.
+-- @return number, int The extracted number and the position of the next character to scan.
+function decode_scanNumber(s,startPos)
+ local endPos = startPos+1
+ local stringLen = string.len(s)
+ local acceptableChars = "+-0123456789.e"
+ while (string.find(acceptableChars, string.sub(s,endPos,endPos), 1, true)
+ and endPos<=stringLen
+ ) do
+ endPos = endPos + 1
+ end
+ local stringValue = 'return ' .. string.sub(s,startPos, endPos-1)
+ local stringEval = load(stringValue)
+ assert(stringEval, 'Failed to scan number [ ' .. stringValue .. '] in JSON string at position ' .. startPos .. ' : ' .. endPos)
+ return stringEval(), endPos
+end
+
+--- Scans a JSON object into a Lua object.
+-- startPos begins at the start of the object.
+-- Returns the object and the next starting position.
+-- @param s The string being scanned.
+-- @param startPos The starting position of the scan.
+-- @return table, int The scanned object as a table and the position of the next character to scan.
+function decode_scanObject(s,startPos)
+ local object = {}
+ local stringLen = string.len(s)
+ local key, value
+ assert(string.sub(s,startPos,startPos)=='{','decode_scanObject called but object does not start at position ' .. startPos .. ' in string:\n' .. s)
+ startPos = startPos + 1
+ repeat
+ startPos = decode_scanWhitespace(s,startPos)
+ assert(startPos<=stringLen, 'JSON string ended unexpectedly while scanning object.')
+ local curChar = string.sub(s,startPos,startPos)
+ if (curChar=='}') then
+ return object,startPos+1
+ end
+ if (curChar==',') then
+ startPos = decode_scanWhitespace(s,startPos+1)
+ end
+ assert(startPos<=stringLen, 'JSON string ended unexpectedly scanning object.')
+ -- Scan the key
+ key, startPos = json.decode(s,startPos)
+ assert(startPos<=stringLen, 'JSON string ended unexpectedly searching for value of key ' .. key)
+ startPos = decode_scanWhitespace(s,startPos)
+ assert(startPos<=stringLen, 'JSON string ended unexpectedly searching for value of key ' .. key)
+ assert(string.sub(s,startPos,startPos)==':','JSON object key-value assignment mal-formed at ' .. startPos)
+ startPos = decode_scanWhitespace(s,startPos+1)
+ assert(startPos<=stringLen, 'JSON string ended unexpectedly searching for value of key ' .. key)
+ value, startPos = json.decode(s,startPos)
+ object[key]=value
+ until false -- infinite loop while key-value pairs are found
+end
+
+-- START SoniEx2
+-- Initialize some things used by decode_scanString
+-- You know, for efficiency
+local escapeSequences = {
+ ["\\t"] = "\t",
+ ["\\f"] = "\f",
+ ["\\r"] = "\r",
+ ["\\n"] = "\n",
+ ["\\b"] = "\b"
+}
+setmetatable(escapeSequences, {__index = function(t,k)
+ -- skip "\" aka strip escape
+ return string.sub(k,2)
+end})
+-- END SoniEx2
+
+--- Scans a JSON string from the opening inverted comma or single quote to the
+-- end of the string.
+-- Returns the string extracted as a Lua string,
+-- and the position of the next non-string character
+-- (after the closing inverted comma or single quote).
+-- @param s The string being scanned.
+-- @param startPos The starting position of the scan.
+-- @return string, int The extracted string as a Lua string, and the next character to parse.
+function decode_scanString(s,startPos)
+ assert(startPos, 'decode_scanString(..) called without start position')
+ local startChar = string.sub(s,startPos,startPos)
+ -- START SoniEx2
+ -- PS: I don't think single quotes are valid JSON
+ assert(startChar == [["]] or startChar == [[']],'decode_scanString called for a non-string')
+ --assert(startPos, "String decoding failed: missing closing " .. startChar .. " for string at position " .. oldStart)
+ local t = {}
+ local i,j = startPos,startPos
+ while string.find(s, startChar, j+1) ~= j+1 do
+ local oldj = j
+ i,j = string.find(s, "\\.", j+1)
+ local x,y = string.find(s, startChar, oldj+1)
+ if not i or x < i then
+ i,j = x,y-1
+ end
+ table.insert(t, string.sub(s, oldj+1, i-1))
+ if string.sub(s, i, j) == "\\u" then
+ local a = string.sub(s,j+1,j+4)
+ j = j + 4
+ local n = tonumber(a, 16)
+ assert(n, "String decoding failed: bad Unicode escape " .. a .. " at position " .. i .. " : " .. j)
+ -- math.floor(x/2^y) == lazy right shift
+ -- a % 2^b == bitwise_and(a, (2^b)-1)
+ -- 64 = 2^6
+ -- 4096 = 2^12 (or 2^6 * 2^6)
+ local x
+ if n < 0x80 then
+ x = string.char(n % 0x80)
+ elseif n < 0x800 then
+ -- [110x xxxx] [10xx xxxx]
+ x = string.char(0xC0 + (math.floor(n/64) % 0x20), 0x80 + (n % 0x40))
+ else
+ -- [1110 xxxx] [10xx xxxx] [10xx xxxx]
+ x = string.char(0xE0 + (math.floor(n/4096) % 0x10), 0x80 + (math.floor(n/64) % 0x40), 0x80 + (n % 0x40))
+ end
+ table.insert(t, x)
+ else
+ table.insert(t, escapeSequences[string.sub(s, i, j)])
+ end
+ end
+ table.insert(t,string.sub(j, j+1))
+ assert(string.find(s, startChar, j+1), "String decoding failed: missing closing " .. startChar .. " at position " .. j .. "(for string at position " .. startPos .. ")")
+ return table.concat(t,""), j+2
+ -- END SoniEx2
+end
+
+--- Scans a JSON string skipping all whitespace from the current start position.
+-- Returns the position of the first non-whitespace character, or nil if the whole end of string is reached.
+-- @param s The string being scanned
+-- @param startPos The starting position where we should begin removing whitespace.
+-- @return int The first position where non-whitespace was encountered, or string.len(s)+1 if the end of string
+-- was reached.
+function decode_scanWhitespace(s,startPos)
+ local whitespace=" \n\r\t"
+ local stringLen = string.len(s)
+ while ( string.find(whitespace, string.sub(s,startPos,startPos), 1, true) and startPos <= stringLen) do
+ startPos = startPos + 1
+ end
+ return startPos
+end
+
+--- Encodes a string to be JSON-compatible.
+-- This just involves back-quoting inverted commas, back-quotes and newlines, I think ;-)
+-- @param s The string to return as a JSON encoded (i.e. backquoted string)
+-- @return The string appropriately escaped.
+
+local escapeList = {
+ ['"'] = '\\"',
+ ['\\'] = '\\\\',
+ ['/'] = '\\/',
+ ['\b'] = '\\b',
+ ['\f'] = '\\f',
+ ['\n'] = '\\n',
+ ['\r'] = '\\r',
+ ['\t'] = '\\t'
+}
+
+function json_private.encodeString(s)
+ local s = tostring(s)
+ return s:gsub(".", function(c) return escapeList[c] end) -- SoniEx2: 5.0 compat
+end
+
+-- Determines whether the given Lua type is an array or a table / dictionary.
+-- We consider any table an array if it has indexes 1..n for its n items, and no
+-- other data in the table.
+-- I think this method is currently a little 'flaky', but can't think of a good way around it yet...
+-- @param t The table to evaluate as an array
+-- @return boolean, number True if the table can be represented as an array, false otherwise. If true,
+-- the second returned value is the maximum
+-- number of indexed elements in the array.
+function isArray(t)
+ -- Next we count all the elements, ensuring that any non-indexed elements are not-encodable
+ -- (with the possible exception of 'n')
+ if (t == json.EMPTY_ARRAY) then return true, 0 end
+ if (t == json.EMPTY_OBJECT) then return false end
+
+ local maxIndex = 0
+ for k,v in pairs(t) do
+ if (type(k)=='number' and math.floor(k)==k and 1<=k) then -- k,v is an indexed pair
+ if (not isEncodable(v)) then return false end -- All array elements must be encodable
+ maxIndex = math.max(maxIndex,k)
+ else
+ if (k=='n') then
+ if v ~= (t.n or #t) then return false end -- False if n does not hold the number of elements
+ else -- Else of (k=='n')
+ if isEncodable(v) then return false end
+ end -- End of (k~='n')
+ end -- End of k,v not an indexed pair
+ end -- End of loop across all pairs
+ return true, maxIndex
+end
+
+--- Determines whether the given Lua object / table / variable can be JSON encoded. The only
+-- types that are JSON encodable are: string, boolean, number, nil, table and json.null.
+-- In this implementation, all other types are ignored.
+-- @param o The object to examine.
+-- @return boolean True if the object should be JSON encoded, false if it should be ignored.
+function isEncodable(o)
+ local t = type(o)
+ return (t=='string' or t=='boolean' or t=='number' or t=='nil' or t=='table') or
+ (t=='function' and o==json.null)
+end
+
+return json
diff --git a/Resources/DefaultContent/Libraries/json4lua/json/rpc.lua b/Resources/DefaultContent/Libraries/json4lua/json/rpc.lua
new file mode 100644
index 0000000..952c5b5
--- /dev/null
+++ b/Resources/DefaultContent/Libraries/json4lua/json/rpc.lua
@@ -0,0 +1,107 @@
+-----------------------------------------------------------------------------
+-- JSONRPC4Lua: JSON RPC client calls over http for the Lua language.
+-- json.rpc Module.
+-- Author: Craig Mason-Jones
+-- Homepage: http://github.com/craigmj/json4lua/
+-- Version: 1.0.0
+-- This module is released under the MIT License (MIT).
+-- Please see LICENCE.txt for details.
+--
+-- USAGE:
+-- This module exposes two functions:
+-- proxy( 'url')
+-- Returns a proxy object for calling the JSON RPC Service at the given url.
+-- call ( 'url', 'method', ...)
+-- Calls the JSON RPC server at the given url, invokes the appropriate method, and
+-- passes the remaining parameters. Returns the result and the error. If the result is nil, an error
+-- should be there (or the system returned a null). If an error is there, the result should be nil.
+--
+-- REQUIREMENTS:
+-- Lua socket 2.0 (http://www.cs.princeton.edu/~diego/professional/luasocket/)
+-- json (The JSON4Lua package with which it is bundled)
+-- compat-5.1 if using Lua 5.0.
+-----------------------------------------------------------------------------
+
+local json = require('json')
+json.rpc = {} -- Module public namespace
+
+-----------------------------------------------------------------------------
+-- Imports and dependencies
+-----------------------------------------------------------------------------
+local json = require('json')
+local http = require("socket.http")
+
+-----------------------------------------------------------------------------
+-- PUBLIC functions
+-----------------------------------------------------------------------------
+
+--- Creates an RPC Proxy object for the given Url of a JSON-RPC server.
+-- @param url The URL for the JSON RPC Server.
+-- @return Object on which JSON-RPC remote methods can be called.
+-- EXAMPLE Usage:
+-- local jsolait = json.rpc.proxy('http://jsolait.net/testj.py')
+-- print(jsolait.echo('This is a test of the echo method!'))
+-- print(jsolait.args2String('first','second','third'))
+-- table.foreachi( jsolait.args2Array(5,4,3,2,1), print)
+function json.rpc.proxy(url)
+ local serverProxy = {}
+ local proxyMeta = {
+ __index = function(self, key)
+ return function(...)
+ return json.rpc.call(url, key, ...)
+ end
+ end
+ }
+ setmetatable(serverProxy, proxyMeta)
+ return serverProxy
+end
+
+--- Calls a JSON RPC method on a remote server.
+-- Returns a boolean true if the call succeeded, false otherwise.
+-- On success, the second returned parameter is the decoded
+-- JSON object from the server.
+-- On http failure, returns nil and an error message.
+-- On success, returns the result and nil.
+-- @param url The url of the JSON RPC server.
+-- @param method The method being called.
+-- @param ... Parameters to pass to the method.
+-- @return result, error The JSON RPC result and error. One or the other should be nil. If both
+-- are nil, this means that the result of the RPC call was nil.
+-- EXAMPLE Usage:
+-- print(json.rpc.call('http://jsolait.net/testj.py','echo','This string will be returned'))
+function json.rpc.call(url, method, ...)
+ local JSONRequestArray = {
+ id=tostring(math.random()),
+ ["method"]=method,
+ ["jsonrpc"]="2.0",
+ params = ...
+ }
+ local httpResponse, result , code
+ local jsonRequest = json.encode(JSONRequestArray)
+ -- We use the sophisticated http.request form (with ltn12 sources and sinks) so that
+ -- we can set the content-type to text/plain. While this shouldn't strictly-speaking be true,
+ -- it seems a good idea (Xavante won't work w/out a content-type header, although a patch
+ -- is needed to Xavante to make it work with text/plain)
+ local ltn12 = require('ltn12')
+ local resultChunks = {}
+ httpResponse, code = http.request(
+ { ['url'] = url,
+ sink = ltn12.sink.table(resultChunks),
+ method = 'POST',
+ headers = { ['content-type']='application/json-rpc', ['content-length']=string.len(jsonRequest) },
+ source = ltn12.source.string(jsonRequest)
+ }
+ )
+ httpResponse = table.concat(resultChunks)
+ -- Check the http response code
+ if (code~=200) then
+ return nil, "HTTP ERROR: " .. code
+ end
+ -- And decode the httpResponse and check the JSON RPC result code
+ result = json.decode( httpResponse )
+ if result.result then
+ return result.result, nil
+ else
+ return nil, result.error
+ end
+end
diff --git a/Resources/DefaultContent/Libraries/json4lua/json/rpcserver.lua b/Resources/DefaultContent/Libraries/json4lua/json/rpcserver.lua
new file mode 100644
index 0000000..e01f1f8
--- /dev/null
+++ b/Resources/DefaultContent/Libraries/json4lua/json/rpcserver.lua
@@ -0,0 +1,78 @@
+-----------------------------------------------------------------------------
+-- JSONRPC4Lua: JSON RPC server for exposing Lua objects as JSON RPC callable
+-- objects via http.
+-- json.rpcserver Module.
+-- Author: Craig Mason-Jones
+-- Homepage: http://github.com/craigmj/json4lua/
+-- Version: 1.0.0
+-- This module is released under the MIT License (MIT).
+-- Please see LICENCE.txt for details.
+--
+-- USAGE:
+-- This module exposes one function:
+-- server(luaClass, packReturn)
+-- Manages incoming JSON RPC request forwarding the method call to the given
+-- object. If packReturn is true, multiple return values are packed into an
+-- array on return.
+--
+-- IMPORTANT NOTES:
+-- 1. This version ought really not be 0.9.10, since this particular part of the
+-- JSONRPC4Lua package is very first-draft. However, the JSON4Lua package with which
+-- it comes is quite solid, so there you have it :-)
+-- 2. This has only been tested with Xavante webserver, with which it works
+-- if you patch CGILua to accept 'text/plain' content type. See doc\cgilua_patch.html
+-- for details.
+----------------------------------------------------------------------------
+
+module ('json.rpcserver')
+
+---
+-- Implements a JSON RPC Server wrapping for luaClass, exposing each of luaClass's
+-- methods as JSON RPC callable methods.
+-- @param luaClass The JSON RPC class to expose.
+-- @param packReturn If true, the server will automatically wrap any
+-- multiple-value returns into an array. Single returns remain single returns. If
+-- false, when a function returns multiple values, only the first of these values will
+-- be returned.
+--
+function serve(luaClass, packReturn)
+ cgilua.contentheader('text','plain')
+ require('cgilua')
+ require ('json')
+ local postData = ""
+
+ if not cgilua.servervariable('CONTENT_LENGTH') then
+ cgilua.put("Please access JSON Request using HTTP POST Request")
+ return 0
+ else
+ postData = cgi[1] -- SAPI.Request.getpostdata() --[[{ "id":1, "method":"echo","params":["Hi there"]}]] --
+ end
+ -- @TODO Catch an error condition on decoding the data
+ local jsonRequest = json.decode(postData)
+ local jsonResponse = {}
+ jsonResponse.id = jsonRequest.id
+ local method = luaClass[ jsonRequest.method ]
+
+ if not method then
+ jsonResponse.error = 'Method ' .. jsonRequest.method .. ' does not exist at this server.'
+ else
+ local callResult = { pcall( method, unpack( jsonRequest.params ) ) }
+ if callResult[1] then -- Function call successfull
+ table.remove(callResult,1)
+ if packReturn and table.getn(callResult)>1 then
+ jsonResponse.result = callResult
+ else
+ jsonResponse.result = unpack(callResult) -- NB: Does not support multiple argument returns
+ end
+ else
+ jsonResponse.error = callResult[2]
+ end
+ end
+
+ -- Output the result
+ -- TODO: How to be sure that the result and error tags are there even when they are nil in Lua?
+ -- Can force them by hand... ?
+ cgilua.contentheader('text','plain')
+ cgilua.put( json.encode( jsonResponse ) )
+end
+
diff --git a/Resources/DefaultContent/Libraries/json4lua/json4lua-1.0.0-1.rockspec b/Resources/DefaultContent/Libraries/json4lua/json4lua-1.0.0-1.rockspec
new file mode 100644
index 0000000..b3b737a
--- /dev/null
+++ b/Resources/DefaultContent/Libraries/json4lua/json4lua-1.0.0-1.rockspec
@@ -0,0 +1,32 @@
+package="JSON4Lua"
+version="1.0.0"
+source = {
+ url = "git://github.com/craigmj/json4lua.git",
+ tag = "1.0.0"
+}
+description = {
+ summary = "JSON4Lua and JSONRPC4Lua implement JSON (JavaScript Object Notation) encoding and decoding and a JSON-RPC-over-http client for Lua.",
+ detailed = [[
+ JSON4Lua and JSONRPC4Lua implement JSON (JavaScript Object Notation)
+ encoding and decoding and a JSON-RPC-over-http client for Lua.
+ JSON is JavaScript Object Notation, a simple encoding of
+ Javascript-like objects that is ideal for lightweight transmission
+ of relatively weakly-typed data. A sub-package of JSON4Lua is
+ JSONRPC4Lua, which provides a simple JSON-RPC-over-http client and server
+ (in a CGILua environment) for Lua.
+ ]],
+ homepage = "http://github.com/craigmj/json4lua/",
+ license = "GPL"
+}
+dependencies = {
+ "lua >= 5.2",
+ "luasocket",
+}
+
+build = {
+ type = "builtin",
+ modules = {
+ ["json"] = "json/json.lua",
+ ["json.rpc"] = "json/rpc.lua"
+ }
+}
diff --git a/Resources/DefaultContent/Libraries/lbase64/.gitignore b/Resources/DefaultContent/Libraries/lbase64/.gitignore
new file mode 100644
index 0000000..a70719a
--- /dev/null
+++ b/Resources/DefaultContent/Libraries/lbase64/.gitignore
@@ -0,0 +1,3 @@
+*.out
+*.swp
+*.swo
diff --git a/Resources/DefaultContent/Libraries/lbase64/.travis.yml b/Resources/DefaultContent/Libraries/lbase64/.travis.yml
new file mode 100644
index 0000000..7bca356
--- /dev/null
+++ b/Resources/DefaultContent/Libraries/lbase64/.travis.yml
@@ -0,0 +1,25 @@
+language: python
+sudo: false
+
+env:
+ - LUA="lua 5.1"
+ - LUA="lua 5.2"
+ - LUA="lua 5.3"
+ - LUA="lua 5.4"
+ - LUA="luajit 2.0"
+ - LUA="luajit 2.1"
+
+before_install:
+ - pip install hererocks
+ - hererocks env --$LUA -rlatest # Use latest LuaRocks, install into 'env' directory.
+ - source env/bin/activate # Add directory with all installed binaries to PATH.notifications:
+
+notifications:
+ email: false
+
+install:
+ - luarocks install luacheck
+
+script:
+ - luacheck --no-unused-args *.lua
+ - lua test.lua
diff --git a/Resources/DefaultContent/Libraries/lbase64/README.md b/Resources/DefaultContent/Libraries/lbase64/README.md
new file mode 100644
index 0000000..1b5b0ee
--- /dev/null
+++ b/Resources/DefaultContent/Libraries/lbase64/README.md
@@ -0,0 +1,48 @@
+[![Build Status](https://travis-ci.org/iskolbin/lbase64.svg?branch=master)](https://travis-ci.org/iskolbin/lbase64)
+[![license](https://img.shields.io/badge/license-public%20domain-blue.svg)]()
+[![MIT Licence](https://badges.frapsoft.com/os/mit/mit.svg?v=103)](https://opensource.org/licenses/mit-license.php)
+
+Lua base64 encoder/decoder
+==========================
+
+Pure Lua [base64](https://en.wikipedia.org/wiki/Base64) encoder/decoder. Works with
+Lua 5.1+ and LuaJIT. Fallbacks to pure Lua bit operations if bit/bit32/native bit
+operators are not available.
+
+```lua
+local base64 = require'base64'
+local str = 'Man is distinguished, not only by his reason, but by this singular passion from other animals, which is a lust of the mind, that by a perseverance of delight in the continued and indefatigable generation of knowledge, exceeds the short vehemence of any carnal pleasure.'
+local b64str = 'TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGludWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4='
+local encoded = base64.encode( str )
+local decoded = base64.decode( b64str )
+assert( str == decoded )
+assert( b64str == encoded )
+```
+
+base64.encode( str, encoder = DEFAULT, usecache = false )
+---------------------------------------------------------
+Encodes `str` string using `encoder` table. By default uses table with `+` as
+char for 62, `/` as char for 63 and `=` as padding char. You can specify custom
+encoder. For this you could use `base64.makeencoder`. If you are encoding large
+chunks of text (or another highly redundant data) it's possible to highly
+increase performace (for text approx. x2 gain) by using `usecache = true`. For
+binary data like images using cache decreasing performance.
+
+base64.decode( str, decoder = DEFAULT, usecache = false )
+---------------------------------------------------------
+Decodes `str` string using `decoder` table. Default decoder uses same chars as
+default encoder.
+
+base64.makeencoder( s62 = '+', s63 = '/', spad = '=' )
+------------------------------------------------------
+Make custom encoding table
+
+base64.makedecoder( s62 = '+', s63 = '/', spad = '=' )
+------------------------------------------------------
+Make custom decoding table
+
+Install
+-------
+```bash
+luarocks install base64
+```
diff --git a/Resources/DefaultContent/Libraries/lbase64/base64.lua b/Resources/DefaultContent/Libraries/lbase64/base64.lua
new file mode 100644
index 0000000..32de332
--- /dev/null
+++ b/Resources/DefaultContent/Libraries/lbase64/base64.lua
@@ -0,0 +1,201 @@
+--[[
+
+ base64 -- v1.5.3 public domain Lua base64 encoder/decoder
+ no warranty implied; use at your own risk
+
+ Needs bit32.extract function. If not present it's implemented using BitOp
+ or Lua 5.3 native bit operators. For Lua 5.1 fallbacks to pure Lua
+ implementation inspired by Rici Lake's post:
+ http://ricilake.blogspot.co.uk/2007/10/iterating-bits-in-lua.html
+
+ author: Ilya Kolbin (iskolbin@gmail.com)
+ url: github.com/iskolbin/lbase64
+
+ COMPATIBILITY
+
+ Lua 5.1+, LuaJIT
+
+ LICENSE
+
+ See end of file for license information.
+
+--]]
+
+
+local base64 = {}
+
+local extract = _G.bit32 and _G.bit32.extract -- Lua 5.2/Lua 5.3 in compatibility mode
+if not extract then
+ if _G.bit then -- LuaJIT
+ local shl, shr, band = _G.bit.lshift, _G.bit.rshift, _G.bit.band
+ extract = function( v, from, width )
+ return band( shr( v, from ), shl( 1, width ) - 1 )
+ end
+ elseif _G._VERSION == "Lua 5.1" then
+ extract = function( v, from, width )
+ local w = 0
+ local flag = 2^from
+ for i = 0, width-1 do
+ local flag2 = flag + flag
+ if v % flag2 >= flag then
+ w = w + 2^i
+ end
+ flag = flag2
+ end
+ return w
+ end
+ else -- Lua 5.3+
+ extract = load[[return function( v, from, width )
+ return ( v >> from ) & ((1 << width) - 1)
+ end]]()
+ end
+end
+
+
+function base64.makeencoder( s62, s63, spad )
+ local encoder = {}
+ for b64code, char in pairs{[0]='A','B','C','D','E','F','G','H','I','J',
+ 'K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y',
+ 'Z','a','b','c','d','e','f','g','h','i','j','k','l','m','n',
+ 'o','p','q','r','s','t','u','v','w','x','y','z','0','1','2',
+ '3','4','5','6','7','8','9',s62 or '+',s63 or'/',spad or'='} do
+ encoder[b64code] = char:byte()
+ end
+ return encoder
+end
+
+function base64.makedecoder( s62, s63, spad )
+ local decoder = {}
+ for b64code, charcode in pairs( base64.makeencoder( s62, s63, spad )) do
+ decoder[charcode] = b64code
+ end
+ return decoder
+end
+
+local DEFAULT_ENCODER = base64.makeencoder()
+local DEFAULT_DECODER = base64.makedecoder()
+
+local char, concat = string.char, table.concat
+
+function base64.encode( str, encoder, usecaching )
+ encoder = encoder or DEFAULT_ENCODER
+ local t, k, n = {}, 1, #str
+ local lastn = n % 3
+ local cache = {}
+ for i = 1, n-lastn, 3 do
+ local a, b, c = str:byte( i, i+2 )
+ local v = a*0x10000 + b*0x100 + c
+ local s
+ if usecaching then
+ s = cache[v]
+ if not s then
+ s = char(encoder[extract(v,18,6)], encoder[extract(v,12,6)], encoder[extract(v,6,6)], encoder[extract(v,0,6)])
+ cache[v] = s
+ end
+ else
+ s = char(encoder[extract(v,18,6)], encoder[extract(v,12,6)], encoder[extract(v,6,6)], encoder[extract(v,0,6)])
+ end
+ t[k] = s
+ k = k + 1
+ end
+ if lastn == 2 then
+ local a, b = str:byte( n-1, n )
+ local v = a*0x10000 + b*0x100
+ t[k] = char(encoder[extract(v,18,6)], encoder[extract(v,12,6)], encoder[extract(v,6,6)], encoder[64])
+ elseif lastn == 1 then
+ local v = str:byte( n )*0x10000
+ t[k] = char(encoder[extract(v,18,6)], encoder[extract(v,12,6)], encoder[64], encoder[64])
+ end
+ return concat( t )
+end
+
+function base64.decode( b64, decoder, usecaching )
+ decoder = decoder or DEFAULT_DECODER
+ local pattern = '[^%w%+%/%=]'
+ if decoder then
+ local s62, s63
+ for charcode, b64code in pairs( decoder ) do
+ if b64code == 62 then s62 = charcode
+ elseif b64code == 63 then s63 = charcode
+ end
+ end
+ pattern = ('[^%%w%%%s%%%s%%=]'):format( char(s62), char(s63) )
+ end
+ b64 = b64:gsub( pattern, '' )
+ local cache = usecaching and {}
+ local t, k = {}, 1
+ local n = #b64
+ local padding = b64:sub(-2) == '==' and 2 or b64:sub(-1) == '=' and 1 or 0
+ for i = 1, padding > 0 and n-4 or n, 4 do
+ local a, b, c, d = b64:byte( i, i+3 )
+ local s
+ if usecaching then
+ local v0 = a*0x1000000 + b*0x10000 + c*0x100 + d
+ s = cache[v0]
+ if not s then
+ local v = decoder[a]*0x40000 + decoder[b]*0x1000 + decoder[c]*0x40 + decoder[d]
+ s = char( extract(v,16,8), extract(v,8,8), extract(v,0,8))
+ cache[v0] = s
+ end
+ else
+ local v = decoder[a]*0x40000 + decoder[b]*0x1000 + decoder[c]*0x40 + decoder[d]
+ s = char( extract(v,16,8), extract(v,8,8), extract(v,0,8))
+ end
+ t[k] = s
+ k = k + 1
+ end
+ if padding == 1 then
+ local a, b, c = b64:byte( n-3, n-1 )
+ local v = decoder[a]*0x40000 + decoder[b]*0x1000 + decoder[c]*0x40
+ t[k] = char( extract(v,16,8), extract(v,8,8))
+ elseif padding == 2 then
+ local a, b = b64:byte( n-3, n-2 )
+ local v = decoder[a]*0x40000 + decoder[b]*0x1000
+ t[k] = char( extract(v,16,8))
+ end
+ return concat( t )
+end
+
+return base64
+
+--[[
+------------------------------------------------------------------------------
+This software is available under 2 licenses -- choose whichever you prefer.
+------------------------------------------------------------------------------
+ALTERNATIVE A - MIT License
+Copyright (c) 2018 Ilya Kolbin
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+------------------------------------------------------------------------------
+ALTERNATIVE B - Public Domain (www.unlicense.org)
+This is free and unencumbered software released into the public domain.
+Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
+software, either in source code form or as a compiled binary, for any purpose,
+commercial or non-commercial, and by any means.
+In jurisdictions that recognize copyright laws, the author or authors of this
+software dedicate any and all copyright interest in the software to the public
+domain. We make this dedication for the benefit of the public at large and to
+the detriment of our heirs and successors. We intend this dedication to be an
+overt act of relinquishment in perpetuity of all present and future rights to
+this software under copyright law.
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+------------------------------------------------------------------------------
+--]]
diff --git a/Resources/DefaultContent/Libraries/lbase64/bench.lua b/Resources/DefaultContent/Libraries/lbase64/bench.lua
new file mode 100644
index 0000000..d24c1bf
--- /dev/null
+++ b/Resources/DefaultContent/Libraries/lbase64/bench.lua
@@ -0,0 +1,76 @@
+local base64 = require'base64'
+local N = 10000000
+local st = {}
+local letters = ' abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'
+ .. 'абвгдеёжзийклмнопрстуфхцшщчъыьэюя'
+ .. 'АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦШЩЧЪЫЬЭЮЯ'
+local nletters = #letters
+for i = 1, N do
+ local j = math.random( nletters )
+ st[i] = letters:sub( j, j )
+end
+local s = table.concat( st )
+local t = os.clock()
+local encoded = base64.encode( s )
+local encodetime = os.clock() - t
+
+t = os.clock()
+local decoded = base64.decode( encoded )
+local decodetime = os.clock() - t
+
+assert( s == decoded )
+print('Common text')
+print(('Encoding: %d bytes/sec'):format( math.floor(N/encodetime)))
+print(('Decoding: %d bytes/sec'):format( math.floor(N/decodetime)))
+collectgarbage()
+
+t = os.clock()
+encoded = base64.encode( s, nil, true )
+encodetime = os.clock() - t
+
+t = os.clock()
+decoded = base64.decode( encoded, nil, true )
+assert( s == decoded )
+decodetime = os.clock() - t
+print('Common text (cache)')
+print(('Encoding: %d bytes/sec'):format( math.floor(N/encodetime)))
+print(('Decoding: %d bytes/sec'):format( math.floor(N/decodetime)))
+collectgarbage()
+
+local lt = {}
+for i = 0, 255 do
+ lt[i] = string.char(i)
+end
+nletters = #lt
+for i = 1, N do
+ local j = math.random( nletters )
+ st[i] = lt[j]
+end
+s = table.concat( st )
+
+t = os.clock()
+encoded = base64.encode( s, nil )
+encodetime = os.clock() - t
+
+t = os.clock()
+decoded = base64.decode( encoded )
+decodetime = os.clock() - t
+
+assert( s == decoded )
+print('Binary')
+print(('Encoding: %d bytes/sec'):format( math.floor(N/encodetime)))
+print(('Decoding: %d bytes/sec'):format( math.floor(N/decodetime)))
+collectgarbage()
+
+t = os.clock()
+encoded = base64.encode( s, nil, true )
+encodetime = os.clock() - t
+
+t = os.clock()
+decoded = base64.decode( encoded, nil, true )
+assert( s == decoded )
+decodetime = os.clock() - t
+print('Binary (cache)')
+print(('Encoding: %d bytes/sec'):format( math.floor(N/encodetime)))
+print(('Decoding: %d bytes/sec'):format( math.floor(N/decodetime)))
+collectgarbage()
diff --git a/Resources/DefaultContent/Libraries/lbase64/rockspec/base64-1.5-1.rockspec b/Resources/DefaultContent/Libraries/lbase64/rockspec/base64-1.5-1.rockspec
new file mode 100644
index 0000000..f25c7b4
--- /dev/null
+++ b/Resources/DefaultContent/Libraries/lbase64/rockspec/base64-1.5-1.rockspec
@@ -0,0 +1,20 @@
+package = "base64"
+version = "1.5-1"
+source = {
+ url = "git+https://github.com/iskolbin/lbase64",
+ tag = "v1.5.1",
+}
+description = {
+ summary = "Pure Lua base64 encoder/decoder",
+ detailed = [[
+Pure Lua [base64](https://en.wikipedia.org/wiki/Base64) encoder/decoder. Works with Lua 5.1+ and LuaJIT. Fallbacks to pure Lua bit operations if bit/bit32/native bit operators are not available.]],
+ homepage = "https://github.com/iskolbin/lbase64",
+ license = "MIT/Public Domain"
+}
+dependencies = {}
+build = {
+ type = "builtin",
+ modules = {
+ base64 = "base64.lua",
+ }
+}
diff --git a/Resources/DefaultContent/Libraries/lbase64/rockspec/base64-1.5-2.rockspec b/Resources/DefaultContent/Libraries/lbase64/rockspec/base64-1.5-2.rockspec
new file mode 100644
index 0000000..7d0addd
--- /dev/null
+++ b/Resources/DefaultContent/Libraries/lbase64/rockspec/base64-1.5-2.rockspec
@@ -0,0 +1,20 @@
+package = "base64"
+version = "1.5-2"
+source = {
+ url = "git://github.com/iskolbin/lbase64",
+ tag = "v1.5.2",
+}
+description = {
+ summary = "Pure Lua base64 encoder/decoder",
+ detailed = [[
+Pure Lua [base64](https://en.wikipedia.org/wiki/Base64) encoder/decoder. Works with Lua 5.1+ and LuaJIT. Fallbacks to pure Lua bit operations if bit/bit32/native bit operators are not available.]],
+ homepage = "https://github.com/iskolbin/lbase64",
+ license = "MIT/Public Domain"
+}
+dependencies = {}
+build = {
+ type = "builtin",
+ modules = {
+ base64 = "base64.lua",
+ }
+}
diff --git a/Resources/DefaultContent/Libraries/lbase64/rockspec/base64-1.5-3.rockspec b/Resources/DefaultContent/Libraries/lbase64/rockspec/base64-1.5-3.rockspec
new file mode 100644
index 0000000..60706d3
--- /dev/null
+++ b/Resources/DefaultContent/Libraries/lbase64/rockspec/base64-1.5-3.rockspec
@@ -0,0 +1,20 @@
+package = "base64"
+version = "1.5-3"
+source = {
+ url = "git://github.com/iskolbin/lbase64",
+ tag = "v1.5.3",
+}
+description = {
+ summary = "Pure Lua base64 encoder/decoder",
+ detailed = [[
+Pure Lua base64 encoder/decoder. Works with Lua 5.1+ and LuaJIT. Fallbacks to pure Lua bit operations if bit/bit32/native bit operators are not available.]],
+ homepage = "https://github.com/iskolbin/lbase64",
+ license = "MIT/Public Domain"
+}
+dependencies = {}
+build = {
+ type = "builtin",
+ modules = {
+ base64 = "base64.lua",
+ }
+}
diff --git a/Resources/DefaultContent/Libraries/lbase64/test.lua b/Resources/DefaultContent/Libraries/lbase64/test.lua
new file mode 100644
index 0000000..d8efebf
--- /dev/null
+++ b/Resources/DefaultContent/Libraries/lbase64/test.lua
@@ -0,0 +1,47 @@
+local base64 = require('base64')
+
+local function test( s, b64 )
+ assert( base64.encode( s ) == b64 )
+ assert( base64.decode( b64 ) == s )
+ assert( base64.decode( base64.encode( s )) == s )
+ assert( base64.encode( s, nil, true ) == b64 )
+ assert( base64.decode( b64, nil, true ) == s )
+ assert( base64.decode( base64.encode( s, nil, true ), nil, true ) == s )
+end
+
+test( 'any carnal pleasure.', 'YW55IGNhcm5hbCBwbGVhc3VyZS4=' )
+test( 'any carnal pleasure', 'YW55IGNhcm5hbCBwbGVhc3VyZQ==' )
+test( 'any carnal pleasur', 'YW55IGNhcm5hbCBwbGVhc3Vy' )
+test( 'Man is distinguished, not only by his reason, but by this singular passion from other animals, which is a ' ..
+ 'lust of the mind, that by a perseverance of delight in the continued and indefatigable generation of knowledge, ' ..
+ 'exceeds the short vehemence of any carnal pleasure.', 'TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb' ..
+ '24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoY' ..
+ 'XQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGludWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd' ..
+ '2xlZGdlLCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=' )
+test( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et ' ..
+ 'dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea ' ..
+ 'commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat ' ..
+ 'nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit ' ..
+ 'anim id est laborum.', 'TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdCwgc2VkIGRvIGVp' ..
+ 'dXNtb2QgdGVtcG9yIGluY2lkaWR1bnQgdXQgbGFib3JlIGV0IGRvbG9yZSBtYWduYSBhbGlxdWEuIFV0IGVuaW0gYWQgbWluaW0gdmVuaWFtLCBx' ..
+ 'dWlzIG5vc3RydWQgZXhlcmNpdGF0aW9uIHVsbGFtY28gbGFib3JpcyBuaXNpIHV0IGFsaXF1aXAgZXggZWEgY29tbW9kbyBjb25zZXF1YXQuIER1' ..
+ 'aXMgYXV0ZSBpcnVyZSBkb2xvciBpbiByZXByZWhlbmRlcml0IGluIHZvbHVwdGF0ZSB2ZWxpdCBlc3NlIGNpbGx1bSBkb2xvcmUgZXUgZnVnaWF0' ..
+ 'IG51bGxhIHBhcmlhdHVyLiBFeGNlcHRldXIgc2ludCBvY2NhZWNhdCBjdXBpZGF0YXQgbm9uIHByb2lkZW50LCBzdW50IGluIGN1bHBhIHF1aSBv' ..
+ 'ZmZpY2lhIGRlc2VydW50IG1vbGxpdCBhbmltIGlkIGVzdCBsYWJvcnVtLg==')
+test( '«В чащах юга жил бы цитрус? Да, но фальшивый экземпляр!»',
+ 'wqvQkiDRh9Cw0YnQsNGFINGO0LPQsCDQttC40Lsg0LHRiyDR' ..
+ 'htC40YLRgNGD0YE/INCU0LAsINC90L4g0YTQsNC70YzRiNC40LLRi9C5INGN0LrQt9C10LzQv9C70Y/RgCHCuw==')
+test( '«В чащах юга жил бы цитрус? Да, фальшивый экземпляр!»',
+ 'wqvQkiDRh9Cw0YnQsNGFINGO0LPQsCDQttC40Lsg0LHRiyDRhtC' ..
+ '40YLRgNGD0YE/INCU0LAsINGE0LDQu9GM0YjQuNCy0YvQuSDRjdC60LfQtdC80L/Qu9GP0YAhwrs=')
+test( '\137\080\078\071\013\010\026\010\000\000\000\013\073\072\068\082\000\000\000\032\000\000\000\032\001\003\000' ..
+ '\000\000\073\180\232\183\000\000\000\006\080\076\084\069\255\255\255\000\000\000\085\194\211\126\000\000\000\018' ..
+ '\073\068\065\084\008\215\099\248\015\004\196\016\084\006\196\218\011\000\237\189\063\193\243\000\141\059\000\000' ..
+ '\000\000\073\069\078\068\174\066\096\130', 'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgAQMAAABJtOi3AAAABlBMVEX///8AAABVwtN+' ..
+ 'AAAAEklEQVQI12P4DwTEEFQGxNoLAO29P8HzAI07AAAAAElFTkSuQmCC' )
+
+assert( base64.decode('YW55IGNhcm5hbCBwbGVhc3VyZS4=\n\r\\' ) == 'any carnal pleasure.' )
+
+assert( base64.decode('wйqеvнQсуkкiеDнRгhш9щCзwх0ъфYыnвQаsпNрGоFллIдNжGэOё0яLчPQsCDQttC40Lsg0LHRiyDRhtC' ..
+ '40YLRgNGD0YE/INсCмUи0тLьAбsюIЙКNЕG\n\n\n\n\r\rE0LDQu9GM0YjQuNCy0YvQuSDRjdC60LfQtdC80L/Qu9GP0YAhwrs=') ==
+ '«В чащах юга жил бы цитрус? Да, фальшивый экземпляр!»' )
diff --git a/Resources/DefaultContent/Libraries/md5.lua/.travis.yml b/Resources/DefaultContent/Libraries/md5.lua/.travis.yml
new file mode 100644
index 0000000..90bd434
--- /dev/null
+++ b/Resources/DefaultContent/Libraries/md5.lua/.travis.yml
@@ -0,0 +1,34 @@
+language: python
+sudo: false
+
+env:
+ - LUA="lua=5.1"
+ - LUA="lua=5.2"
+ - LUA="lua=5.3"
+ - LUA="luajit=2.0"
+ - LUA="luajit=2.1"
+
+before_install:
+ - pip install hererocks
+ - hererocks lua_install -r^ --$LUA
+ - export PATH=$PATH:$PWD/lua_install/bin # Add directory with all installed binaries to PATH
+
+install:
+ - luarocks install busted
+ - luarocks install luacov
+ - luarocks install luacov-coveralls
+
+script:
+ - busted --verbose --coverage
+
+after_success:
+ - luacov-coveralls --exclude $TRAVIS_BUILD_DIR/lua_install
+
+branches:
+ except:
+ - gh-pages
+
+notifications:
+ email:
+ on_success: change
+ on_failure: always
diff --git a/Resources/DefaultContent/Libraries/md5.lua/CHANGELOG.md b/Resources/DefaultContent/Libraries/md5.lua/CHANGELOG.md
new file mode 100644
index 0000000..a48c47a
--- /dev/null
+++ b/Resources/DefaultContent/Libraries/md5.lua/CHANGELOG.md
@@ -0,0 +1,5 @@
+
+# 1.1.0
+
+* Fixes error with long strings in Lua 5.1 (@pgimeno)
+* Adds incremental mode (@pgimeno)
diff --git a/Resources/DefaultContent/Libraries/md5.lua/MIT-LICENSE.txt b/Resources/DefaultContent/Libraries/md5.lua/MIT-LICENSE.txt
new file mode 100644
index 0000000..1630e47
--- /dev/null
+++ b/Resources/DefaultContent/Libraries/md5.lua/MIT-LICENSE.txt
@@ -0,0 +1,20 @@
+Copyright (c) 2013 Enrique García Cota + Adam Baldwin + hanzao + Equi 4 Software
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/Resources/DefaultContent/Libraries/md5.lua/README.md b/Resources/DefaultContent/Libraries/md5.lua/README.md
new file mode 100644
index 0000000..ee7bbd8
--- /dev/null
+++ b/Resources/DefaultContent/Libraries/md5.lua/README.md
@@ -0,0 +1,62 @@
+md5.lua [![Build Status](https://travis-ci.org/kikito/md5.lua.svg)](https://travis-ci.org/kikito/md5.lua)
+=========================================================================================================
+
+This pure-Lua module computes md5 in Lua 5.1, Lua 5.2 and LuaJIT, using native bit-manipulation libraries when available, and falling back to table-based manipulation of integers in 5.1.
+
+It implements md5.sum and md5.sumhex like the [kernel project md5 package](http://www.keplerproject.org/md5/), but it's done completely in Lua, with no dependencies on other libs or C files.
+
+Usage
+=====
+
+Simple example:
+
+ local md5 = require 'md5'
+
+ local md5_as_data = md5.sum(message) -- returns raw bytes
+ local md5_as_hex = md5.sumhexa(message) -- returns a hex string
+ local md5_as_hex2 = md5.tohex(md5_as_data) -- returns the same string as md5_as_hex
+
+Incremental example (for computing md5 of streams, or big files which have to be loaded in chunks - new since 1.1.0):
+
+ local m = md5.new()
+ m:update('some bytes')
+ m:update('some more bytes')
+ m:update('etc')
+ return md5.tohex(m:finish())
+
+Credits
+=======
+
+This is a cleanup of an implementation by Adam Baldwin - https://gist.github.com/evilpacket/3647908
+
+Which in turn was a mix of the bitwise lib, http://luaforge.net/projects/bit/ by hanzhao (`abrash_han - at - hotmail.com`),
+and http://equi4.com/md5/md5calc.lua, by Equi 4 Software.
+
+Lua 5.2 and LuaJIT compatibility by [Positive07](https://github.com/kikito/md5.lua/pull/2)
+
+A very important fix and the incremental variant by [pgimeno](https://github.com/kikito/md5.lua/pull/10)
+
+
+License
+=======
+
+This library, as well as all the previous ones in which is based, is released under the MIT license (See license file for details).
+
+Specs
+=====
+
+The specs for this library are implemented with [busted](http://ovinelabs.com/busted/). In order to run them, install busted and then:
+
+ cd path/to/where/the/spec/folder/is
+ busted
+
+Install
+=======
+
+Either copy the file or using luarocks:
+
+ luarocks install --server=http://luarocks.org/manifests/kikito md5
+
+
+
+
diff --git a/Resources/DefaultContent/Libraries/md5.lua/md5.lua b/Resources/DefaultContent/Libraries/md5.lua/md5.lua
new file mode 100644
index 0000000..5e73ba6
--- /dev/null
+++ b/Resources/DefaultContent/Libraries/md5.lua/md5.lua
@@ -0,0 +1,396 @@
+local md5 = {
+ _VERSION = "md5.lua 1.1.0",
+ _DESCRIPTION = "MD5 computation in Lua (5.1-3, LuaJIT)",
+ _URL = "https://github.com/kikito/md5.lua",
+ _LICENSE = [[
+ MIT LICENSE
+
+ Copyright (c) 2013 Enrique García Cota + Adam Baldwin + hanzao + Equi 4 Software
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ ]]
+}
+
+-- bit lib implementions
+
+local char, byte, format, rep, sub =
+ string.char, string.byte, string.format, string.rep, string.sub
+local bit_or, bit_and, bit_not, bit_xor, bit_rshift, bit_lshift
+
+local ok, bit = pcall(require, 'bit')
+if ok then
+ bit_or, bit_and, bit_not, bit_xor, bit_rshift, bit_lshift = bit.bor, bit.band, bit.bnot, bit.bxor, bit.rshift, bit.lshift
+else
+ ok, bit = pcall(require, 'bit32')
+
+ if ok then
+
+ bit_not = bit.bnot
+
+ local tobit = function(n)
+ return n <= 0x7fffffff and n or -(bit_not(n) + 1)
+ end
+
+ local normalize = function(f)
+ return function(a,b) return tobit(f(tobit(a), tobit(b))) end
+ end
+
+ bit_or, bit_and, bit_xor = normalize(bit.bor), normalize(bit.band), normalize(bit.bxor)
+ bit_rshift, bit_lshift = normalize(bit.rshift), normalize(bit.lshift)
+
+ else
+
+ local function tbl2number(tbl)
+ local result = 0
+ local power = 1
+ for i = 1, #tbl do
+ result = result + tbl[i] * power
+ power = power * 2
+ end
+ return result
+ end
+
+ local function expand(t1, t2)
+ local big, small = t1, t2
+ if(#big < #small) then
+ big, small = small, big
+ end
+ -- expand small
+ for i = #small + 1, #big do
+ small[i] = 0
+ end
+ end
+
+ local to_bits -- needs to be declared before bit_not
+
+ bit_not = function(n)
+ local tbl = to_bits(n)
+ local size = math.max(#tbl, 32)
+ for i = 1, size do
+ if(tbl[i] == 1) then
+ tbl[i] = 0
+ else
+ tbl[i] = 1
+ end
+ end
+ return tbl2number(tbl)
+ end
+
+ -- defined as local above
+ to_bits = function (n)
+ if(n < 0) then
+ -- negative
+ return to_bits(bit_not(math.abs(n)) + 1)
+ end
+ -- to bits table
+ local tbl = {}
+ local cnt = 1
+ local last
+ while n > 0 do
+ last = n % 2
+ tbl[cnt] = last
+ n = (n-last)/2
+ cnt = cnt + 1
+ end
+
+ return tbl
+ end
+
+ bit_or = function(m, n)
+ local tbl_m = to_bits(m)
+ local tbl_n = to_bits(n)
+ expand(tbl_m, tbl_n)
+
+ local tbl = {}
+ for i = 1, #tbl_m do
+ if(tbl_m[i]== 0 and tbl_n[i] == 0) then
+ tbl[i] = 0
+ else
+ tbl[i] = 1
+ end
+ end
+
+ return tbl2number(tbl)
+ end
+
+ bit_and = function(m, n)
+ local tbl_m = to_bits(m)
+ local tbl_n = to_bits(n)
+ expand(tbl_m, tbl_n)
+
+ local tbl = {}
+ for i = 1, #tbl_m do
+ if(tbl_m[i]== 0 or tbl_n[i] == 0) then
+ tbl[i] = 0
+ else
+ tbl[i] = 1
+ end
+ end
+
+ return tbl2number(tbl)
+ end
+
+ bit_xor = function(m, n)
+ local tbl_m = to_bits(m)
+ local tbl_n = to_bits(n)
+ expand(tbl_m, tbl_n)
+
+ local tbl = {}
+ for i = 1, #tbl_m do
+ if(tbl_m[i] ~= tbl_n[i]) then
+ tbl[i] = 1
+ else
+ tbl[i] = 0
+ end
+ end
+
+ return tbl2number(tbl)
+ end
+
+ bit_rshift = function(n, bits)
+ local high_bit = 0
+ if(n < 0) then
+ -- negative
+ n = bit_not(math.abs(n)) + 1
+ high_bit = 0x80000000
+ end
+
+ local floor = math.floor
+
+ for i=1, bits do
+ n = n/2
+ n = bit_or(floor(n), high_bit)
+ end
+ return floor(n)
+ end
+
+ bit_lshift = function(n, bits)
+ if(n < 0) then
+ -- negative
+ n = bit_not(math.abs(n)) + 1
+ end
+
+ for i=1, bits do
+ n = n*2
+ end
+ return bit_and(n, 0xFFFFFFFF)
+ end
+ end
+end
+
+-- convert little-endian 32-bit int to a 4-char string
+local function lei2str(i)
+ local f=function (s) return char( bit_and( bit_rshift(i, s), 255)) end
+ return f(0)..f(8)..f(16)..f(24)
+end
+
+-- convert raw string to big-endian int
+local function str2bei(s)
+ local v=0
+ for i=1, #s do
+ v = v * 256 + byte(s, i)
+ end
+ return v
+end
+
+-- convert raw string to little-endian int
+local function str2lei(s)
+ local v=0
+ for i = #s,1,-1 do
+ v = v*256 + byte(s, i)
+ end
+ return v
+end
+
+-- cut up a string in little-endian ints of given size
+local function cut_le_str(s,...)
+ local o, r = 1, {}
+ local args = {...}
+ for i=1, #args do
+ table.insert(r, str2lei(sub(s, o, o + args[i] - 1)))
+ o = o + args[i]
+ end
+ return r
+end
+
+local swap = function (w) return str2bei(lei2str(w)) end
+
+-- An MD5 mplementation in Lua, requires bitlib (hacked to use LuaBit from above, ugh)
+-- 10/02/2001 jcw@equi4.com
+
+local CONSTS = {
+ 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee,
+ 0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501,
+ 0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be,
+ 0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821,
+ 0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa,
+ 0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8,
+ 0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed,
+ 0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a,
+ 0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c,
+ 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70,
+ 0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05,
+ 0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665,
+ 0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039,
+ 0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1,
+ 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1,
+ 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391,
+ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476
+}
+
+local f=function (x,y,z) return bit_or(bit_and(x,y),bit_and(-x-1,z)) end
+local g=function (x,y,z) return bit_or(bit_and(x,z),bit_and(y,-z-1)) end
+local h=function (x,y,z) return bit_xor(x,bit_xor(y,z)) end
+local i=function (x,y,z) return bit_xor(y,bit_or(x,-z-1)) end
+local z=function (ff,a,b,c,d,x,s,ac)
+ a=bit_and(a+ff(b,c,d)+x+ac,0xFFFFFFFF)
+ -- be *very* careful that left shift does not cause rounding!
+ return bit_or(bit_lshift(bit_and(a,bit_rshift(0xFFFFFFFF,s)),s),bit_rshift(a,32-s))+b
+end
+
+local function transform(A,B,C,D,X)
+ local a,b,c,d=A,B,C,D
+ local t=CONSTS
+
+ a=z(f,a,b,c,d,X[ 0], 7,t[ 1])
+ d=z(f,d,a,b,c,X[ 1],12,t[ 2])
+ c=z(f,c,d,a,b,X[ 2],17,t[ 3])
+ b=z(f,b,c,d,a,X[ 3],22,t[ 4])
+ a=z(f,a,b,c,d,X[ 4], 7,t[ 5])
+ d=z(f,d,a,b,c,X[ 5],12,t[ 6])
+ c=z(f,c,d,a,b,X[ 6],17,t[ 7])
+ b=z(f,b,c,d,a,X[ 7],22,t[ 8])
+ a=z(f,a,b,c,d,X[ 8], 7,t[ 9])
+ d=z(f,d,a,b,c,X[ 9],12,t[10])
+ c=z(f,c,d,a,b,X[10],17,t[11])
+ b=z(f,b,c,d,a,X[11],22,t[12])
+ a=z(f,a,b,c,d,X[12], 7,t[13])
+ d=z(f,d,a,b,c,X[13],12,t[14])
+ c=z(f,c,d,a,b,X[14],17,t[15])
+ b=z(f,b,c,d,a,X[15],22,t[16])
+
+ a=z(g,a,b,c,d,X[ 1], 5,t[17])
+ d=z(g,d,a,b,c,X[ 6], 9,t[18])
+ c=z(g,c,d,a,b,X[11],14,t[19])
+ b=z(g,b,c,d,a,X[ 0],20,t[20])
+ a=z(g,a,b,c,d,X[ 5], 5,t[21])
+ d=z(g,d,a,b,c,X[10], 9,t[22])
+ c=z(g,c,d,a,b,X[15],14,t[23])
+ b=z(g,b,c,d,a,X[ 4],20,t[24])
+ a=z(g,a,b,c,d,X[ 9], 5,t[25])
+ d=z(g,d,a,b,c,X[14], 9,t[26])
+ c=z(g,c,d,a,b,X[ 3],14,t[27])
+ b=z(g,b,c,d,a,X[ 8],20,t[28])
+ a=z(g,a,b,c,d,X[13], 5,t[29])
+ d=z(g,d,a,b,c,X[ 2], 9,t[30])
+ c=z(g,c,d,a,b,X[ 7],14,t[31])
+ b=z(g,b,c,d,a,X[12],20,t[32])
+
+ a=z(h,a,b,c,d,X[ 5], 4,t[33])
+ d=z(h,d,a,b,c,X[ 8],11,t[34])
+ c=z(h,c,d,a,b,X[11],16,t[35])
+ b=z(h,b,c,d,a,X[14],23,t[36])
+ a=z(h,a,b,c,d,X[ 1], 4,t[37])
+ d=z(h,d,a,b,c,X[ 4],11,t[38])
+ c=z(h,c,d,a,b,X[ 7],16,t[39])
+ b=z(h,b,c,d,a,X[10],23,t[40])
+ a=z(h,a,b,c,d,X[13], 4,t[41])
+ d=z(h,d,a,b,c,X[ 0],11,t[42])
+ c=z(h,c,d,a,b,X[ 3],16,t[43])
+ b=z(h,b,c,d,a,X[ 6],23,t[44])
+ a=z(h,a,b,c,d,X[ 9], 4,t[45])
+ d=z(h,d,a,b,c,X[12],11,t[46])
+ c=z(h,c,d,a,b,X[15],16,t[47])
+ b=z(h,b,c,d,a,X[ 2],23,t[48])
+
+ a=z(i,a,b,c,d,X[ 0], 6,t[49])
+ d=z(i,d,a,b,c,X[ 7],10,t[50])
+ c=z(i,c,d,a,b,X[14],15,t[51])
+ b=z(i,b,c,d,a,X[ 5],21,t[52])
+ a=z(i,a,b,c,d,X[12], 6,t[53])
+ d=z(i,d,a,b,c,X[ 3],10,t[54])
+ c=z(i,c,d,a,b,X[10],15,t[55])
+ b=z(i,b,c,d,a,X[ 1],21,t[56])
+ a=z(i,a,b,c,d,X[ 8], 6,t[57])
+ d=z(i,d,a,b,c,X[15],10,t[58])
+ c=z(i,c,d,a,b,X[ 6],15,t[59])
+ b=z(i,b,c,d,a,X[13],21,t[60])
+ a=z(i,a,b,c,d,X[ 4], 6,t[61])
+ d=z(i,d,a,b,c,X[11],10,t[62])
+ c=z(i,c,d,a,b,X[ 2],15,t[63])
+ b=z(i,b,c,d,a,X[ 9],21,t[64])
+
+ return bit_and(A+a,0xFFFFFFFF),bit_and(B+b,0xFFFFFFFF),
+ bit_and(C+c,0xFFFFFFFF),bit_and(D+d,0xFFFFFFFF)
+end
+
+----------------------------------------------------------------
+
+local function md5_update(self, s)
+ self.pos = self.pos + #s
+ s = self.buf .. s
+ for ii = 1, #s - 63, 64 do
+ local X = cut_le_str(sub(s,ii,ii+63),4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4)
+ assert(#X == 16)
+ X[0] = table.remove(X,1) -- zero based!
+ self.a,self.b,self.c,self.d = transform(self.a,self.b,self.c,self.d,X)
+ end
+ self.buf = sub(s, math.floor(#s/64)*64 + 1, #s)
+ return self
+end
+
+local function md5_finish(self)
+ local msgLen = self.pos
+ local padLen = 56 - msgLen % 64
+
+ if msgLen % 64 > 56 then padLen = padLen + 64 end
+
+ if padLen == 0 then padLen = 64 end
+
+ local s = char(128) .. rep(char(0),padLen-1) .. lei2str(bit_and(8*msgLen, 0xFFFFFFFF)) .. lei2str(math.floor(msgLen/0x20000000))
+ md5_update(self, s)
+
+ assert(self.pos % 64 == 0)
+ return lei2str(self.a) .. lei2str(self.b) .. lei2str(self.c) .. lei2str(self.d)
+end
+
+----------------------------------------------------------------
+
+function md5.new()
+ return { a = CONSTS[65], b = CONSTS[66], c = CONSTS[67], d = CONSTS[68],
+ pos = 0,
+ buf = '',
+ update = md5_update,
+ finish = md5_finish }
+end
+
+function md5.tohex(s)
+ return format("%08x%08x%08x%08x", str2bei(sub(s, 1, 4)), str2bei(sub(s, 5, 8)), str2bei(sub(s, 9, 12)), str2bei(sub(s, 13, 16)))
+end
+
+function md5.sum(s)
+ return md5.new():update(s):finish()
+end
+
+function md5.sumhexa(s)
+ return md5.tohex(md5.sum(s))
+end
+
+return md5
diff --git a/Resources/DefaultContent/Libraries/md5.lua/rockspecs/md5-1.0-0.rockspec b/Resources/DefaultContent/Libraries/md5.lua/rockspecs/md5-1.0-0.rockspec
new file mode 100644
index 0000000..4103148
--- /dev/null
+++ b/Resources/DefaultContent/Libraries/md5.lua/rockspecs/md5-1.0-0.rockspec
@@ -0,0 +1,21 @@
+package = "md5"
+version = "1.0-0"
+source = {
+ url = "https://github.com/kikito/md5.lua/archive/v1.0.0.tar.gz",
+ dir = "md5.lua-1.0.0"
+}
+description = {
+ summary = "MD5 sum in pure Lua, with no C and no external dependencies",
+ detailed = "This pure-Lua module computes md5 in Lua 5.1, Lua 5.2 and LuaJIT, using native bit-manipulation libraries when available, and falling back to table-based manipulation of integers in 5.1",
+ homepage = "https://github.com/kikito/md5.lua",
+ license = "MIT"
+}
+dependencies = {
+ "lua >= 5.1"
+}
+build = {
+ type = "builtin",
+ modules = {
+ md5 = "md5.lua"
+ }
+}
diff --git a/Resources/DefaultContent/Libraries/md5.lua/rockspecs/md5-1.0-1.rockspec b/Resources/DefaultContent/Libraries/md5.lua/rockspecs/md5-1.0-1.rockspec
new file mode 100644
index 0000000..f9f5203
--- /dev/null
+++ b/Resources/DefaultContent/Libraries/md5.lua/rockspecs/md5-1.0-1.rockspec
@@ -0,0 +1,21 @@
+package = "md5"
+version = "1.0-1"
+source = {
+ url = "https://github.com/kikito/md5.lua/archive/v1.0.1.tar.gz",
+ dir = "md5.lua-1.0.1"
+}
+description = {
+ summary = "MD5 sum in pure Lua, with no C and no external dependencies",
+ detailed = "This pure-Lua module computes md5 in Lua 5.1, Lua 5.2 and LuaJIT, using native bit-manipulation libraries when available, and falling back to table-based manipulation of integers in 5.1",
+ homepage = "https://github.com/kikito/md5.lua",
+ license = "MIT"
+}
+dependencies = {
+ "lua >= 5.1"
+}
+build = {
+ type = "builtin",
+ modules = {
+ md5 = "md5.lua"
+ }
+}
diff --git a/Resources/DefaultContent/Libraries/md5.lua/rockspecs/md5-1.0-2.rockspec b/Resources/DefaultContent/Libraries/md5.lua/rockspecs/md5-1.0-2.rockspec
new file mode 100644
index 0000000..c8034f9
--- /dev/null
+++ b/Resources/DefaultContent/Libraries/md5.lua/rockspecs/md5-1.0-2.rockspec
@@ -0,0 +1,21 @@
+package = "md5"
+version = "1.0-2"
+source = {
+ url = "https://github.com/kikito/md5.lua/archive/v1.0.2.tar.gz",
+ dir = "md5.lua-1.0.2"
+}
+description = {
+ summary = "MD5 sum in pure Lua, with no C and no external dependencies",
+ detailed = "This pure-Lua module computes md5 in Lua 5.1, Lua 5.2 and LuaJIT, using native bit-manipulation libraries when available, and falling back to table-based manipulation of integers in 5.1",
+ homepage = "https://github.com/kikito/md5.lua",
+ license = "MIT"
+}
+dependencies = {
+ "lua >= 5.1"
+}
+build = {
+ type = "builtin",
+ modules = {
+ md5 = "md5.lua"
+ }
+}
diff --git a/Resources/DefaultContent/Libraries/md5.lua/rockspecs/md5-1.1-0.rockspec b/Resources/DefaultContent/Libraries/md5.lua/rockspecs/md5-1.1-0.rockspec
new file mode 100644
index 0000000..ef1b392
--- /dev/null
+++ b/Resources/DefaultContent/Libraries/md5.lua/rockspecs/md5-1.1-0.rockspec
@@ -0,0 +1,21 @@
+package = "md5"
+version = "1.1-0"
+source = {
+ url = "https://github.com/kikito/md5.lua/archive/v1.1.0.tar.gz",
+ dir = "md5.lua-1.1.0"
+}
+description = {
+ summary = "MD5 sum in pure Lua, with no C and no external dependencies",
+ detailed = "This pure-Lua module computes md5 in Lua 5.1, Lua 5.2 and LuaJIT, using native bit-manipulation libraries when available, and falling back to table-based manipulation of integers in 5.1",
+ homepage = "https://github.com/kikito/md5.lua",
+ license = "MIT"
+}
+dependencies = {
+ "lua >= 5.1"
+}
+build = {
+ type = "builtin",
+ modules = {
+ md5 = "md5.lua"
+ }
+}
diff --git a/Resources/DefaultContent/Libraries/md5.lua/spec/md5_spec.lua b/Resources/DefaultContent/Libraries/md5.lua/spec/md5_spec.lua
new file mode 100644
index 0000000..69dde39
--- /dev/null
+++ b/Resources/DefaultContent/Libraries/md5.lua/spec/md5_spec.lua
@@ -0,0 +1,40 @@
+local md5 = require('md5')
+
+local function hex2bin(hex)
+ local result, _ = hex:gsub('..', function(hexval)
+ return string.char(tonumber(hexval, 16))
+ end)
+ return result
+end
+
+describe('md5', function()
+ describe('md5.sumhexa', function()
+ it('works', function()
+ assert.equal(md5.sumhexa("asdf"), '912ec803b2ce49e4a541068d495ab570')
+ assert.equal(md5.sumhexa('The quick brown fox jumps over the lazy dog'), '9e107d9d372bb6826bd81d3542a419d6')
+ assert.equal(md5.sumhexa('The quick brown fox jumps over the lazy dog.'), 'e4d909c290d0fb1ca068ffaddf22cbd0')
+ assert.equal(md5.sumhexa(''), 'd41d8cd98f00b204e9800998ecf8427e')
+ assert.equal(md5.sumhexa(('1'):rep(824)), 'a126fd3611ab8d9b7e8a3384e2fa78a0')
+ assert.equal(md5.sumhexa(('1'):rep(1528)), '3750b6a29d923b633e05d6ae76895664')
+ local state = md5.new()
+ state:update('Hello')
+ state:update(', World!')
+ assert.equal(md5.tohex(state:finish()), '65a8e27d8879283831b664bd8b7f0ad4')
+ end)
+ end)
+
+ describe('md5.sum', function()
+ it('works', function()
+ assert.equal(md5.sum("asdf"), hex2bin '912ec803b2ce49e4a541068d495ab570')
+ assert.equal(md5.sum('The quick brown fox jumps over the lazy dog'), hex2bin '9e107d9d372bb6826bd81d3542a419d6')
+ assert.equal(md5.sum('The quick brown fox jumps over the lazy dog.'), hex2bin 'e4d909c290d0fb1ca068ffaddf22cbd0')
+ assert.equal(md5.sum(''), hex2bin 'd41d8cd98f00b204e9800998ecf8427e')
+ assert.equal(md5.sum(('1'):rep(824)), hex2bin 'a126fd3611ab8d9b7e8a3384e2fa78a0')
+ assert.equal(md5.sum(('1'):rep(1528)), hex2bin '3750b6a29d923b633e05d6ae76895664')
+ local state = md5.new()
+ state:update('Hello')
+ state:update(', World!')
+ assert.equal(state:finish(), hex2bin '65a8e27d8879283831b664bd8b7f0ad4')
+ end)
+ end)
+end)
diff --git a/Resources/Libraries/LuaPanda/README.txt b/Resources/Libraries/LuaPanda/README.txt
new file mode 100644
index 0000000..9aca5bc
--- /dev/null
+++ b/Resources/Libraries/LuaPanda/README.txt
@@ -0,0 +1 @@
+https://github.com/Tencent/LuaPanda \ No newline at end of file
diff --git a/Resources/boot.lua b/Resources/boot.lua
index e10cc63..2c8ef45 100644
--- a/Resources/boot.lua
+++ b/Resources/boot.lua
@@ -1,6 +1,6 @@
-- 模块搜索目录
-local engineLuaLibs = "./DefaultContent/Libraries/?.lua" .. ";./DefaultContent/Libraries/?/init.lua" .. ";./DefaultContent/Libraries/?/?.lua"
-local editorLuaLibs = "./Libraries/?.lua" .. ";./Libraries/?/init.lua" .. ";./Libraries/?/?.lua"
+local engineLuaLibs = "./DefaultContent/Libraries/?.lua" .. ";./DefaultContent/Libraries/?/init.lua" .. ";./DefaultContent/Libraries/?/?.lua" .. ";./DefaultContent/Libraries/?/?"
+local editorLuaLibs = "./Libraries/?.lua" .. ";./Libraries/?/init.lua" .. ";./Libraries/?/?.lua" .. ";./Libraries/?/?"
local editorScripts = "./Scripts/?.lua"
package.path=package.path .. ";" .. editorScripts .. ";" .. engineLuaLibs .. ";" .. editorLuaLibs