Program list:

AI
Compressor
HTML and XML parser

In work:

Chemistry homework solver!


[anchor='ai']
AI
SpoilerI made an AI program, type bye to save the wordlist and quit

pastebin get q9XDZ0vv ai

to report a bug, send me a lighshot movie whre you you dir the directory whre you have the program, executes the program with an username that havent used before and show the bug, only pastebin

version 1.4
[anchor='compress']
Compressor
SpoilerPastebin ID: DBPST1kP
how to use:

compressor -create sourcefile output
compressor compressedfile

where sourcefile is a file where each line is a file to compress

it makes a file named readme, you can delete it, it there because the program error if i dont make a file before accepting another file

Im making a GUI, post ideas!

Poll added
[anchor='html']
HTML and XML parser
SpoilerHTML parser
SpoilerI have recoded a html parser that i founded to be compatible with cc-lua

It return a table with the html tree
SpoilerFor example, if the following input is given:

<html><body>
<p>
Click <a href="http://example.com/">here!</a>
<p>
Hello
</p>
</body></html>

Then, the parser produces the following table:

{
_tag = "#document",
_attr = {},
{
_tag = "html",
_attr = {},
{
_tag = "body",
_attr = {},
"\n",
{
_tag = "p",
_attr = {},
"\n Click ",
{
_tag = "a",
_attr = {href = "http://example.com/"}
"here!",
},
"\n",
},
{
_tag = "p",
_attr = {},
"\n Hello\n",
},
"\n",
}
}
}
Usage:
[/size]
		  os.loadAPI("html")
		  a  = html.getTable(filename)
		  --code to use that table
or you can use the function with io.stdin using html.parse(io.stdin) instead of html.getTable or you can parse a single string using html.parsestr(str)

This was modified from https://github.com/v...ree/master/html
the license:
SpoilerCopyright © 2007 T. Kobayashi


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.

pastebin: pastebin get hzYsY0wW html

Currently im working in the next version of this that give you the capability to redner all the thing into a GUI but i cant find a way to read the table and obtain all the elements and a gui api that is enought complete to do it

XML parser
Spoilerpastebin: pastebin get k9qGgNne testxml –(if you want the example to work)
example: pastebin get hDEsi2ZE test –(it creates a xml string and parse it)
README
Spoiler
  • Create a local variable local xml = require("xmlSimple.lua").newParser()
  • Read xml using xml:ParseXmlText(xmlString) or xml:loadFile(xmlFilename, base)
Parsing XML


<test one="two"> <three four="five" four="six"/> <three>eight</three> <nine ten="eleven">twelve</nine></test>
You can access values in two ways:
Using the simple method:

xml.test["@one"] == "two"xml.test.nine["@ten"] == "eleven"xml.test.nine:value() == "twelve"xml.test.three[1]["@four"][1] == "five"xml.test.three[1]["@four"][2] == "six"xml.test.three[2]:value() == "eight"
or if your XML is a little bit more complicated you can do it like this:

xml:children()[1]:name() == "test"xml:children()[1]:children()[2]:value() == "eight"xml:properties()[1] == {name = "one", value = "two"}
Limitations

There's no support for namespaces. When I see namespaces I immediately start to remember days when I worked at corporate. We had to use namespaces only because XML was so convoluted we would not be able to handle it without them. In the end XML parsing took longer for some APIs then actual logic of the API. If you're in this situation it is better to step back and do something about it rather than asking for namespace support. I am using this module to read fairly simple XML. Even if it is a large XML string, the structure is still simple, so I was not able to test it properly. Please create a new Issue if you spot a problem. Please take a loook at xmlTest.lua for an example of use.
Final notes

This is a modified version from the modified version of Corona-XML-Module by Jonathan Beebe which in turn is based on Alexander Makeev's Lua-only XML parser found here for working on cc lua
Post suggestions/bugs!