This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Tag365's profile picture

In Progress ComputerCraft Emulator self extracting script for Touch Lua iOS app

Started by Tag365, 11 May 2015 - 12:37 PM
Tag365 #1
Posted 11 May 2015 - 02:40 PM
Here is the script source:
local data = [===========[{"Event.lua":"print('Hello World!')\nEnu.Timers = {}\n\nEnu.yield = coroutine.yield\n\nfunction os.startTimer(time)\n Enu.Timers[#Enu.Timers + 1] = {sys.gettime() or 0, time or 0, 0}\n –OldPrint(Enu.Timers[#Enu.Timers][2])\n return #Enu.Timers\nend\n\nfunction Enu.CheckTimer()\n\nend\n\nfunction coroutine.yield(filter)\n Enu.CurKey = nil\n draw.tracktouches(Enu.HandleKeyboardFrame, Enu.HandleKeyboardFrame, Enu.HandleKeyboardFrame)\n –local Var1, Var2, Var3, Var4 = Enu.SearchForRedNetMessage()\n –OldPrint(\"Rednet: \"..tostring(Var1), tostring(Var2), tostring(Var3), tostring(Var4))\n if #Enu.Timers > 0 then\n for k, v in ipairs(Enu.Timers) do\n –OldPrint(v[1], v[2], sys.gettime())\n if v then\n if sys.gettime() >= v[1] + v[2] then\n local ID = k\n –OldPrint(\"Fireing timer \"..k)\n if v[3] > 24 then – Do this event 25 times so the event can actually fire\n v[2] = math.huge\n end\n v[3] = v[3] + 1\n return \"timer\", ID\n end\n end\n end\n end\n draw.doevents()\n local key = tonumber(Enu.CurKey)\n if key then\n if Enu.CharacterKeys[key] then\n –OldPrint(key, Enu.CharacterKeys[key])\n return \"char\", Enu.CharacterKeys[key]\n end\n –OldPrint(key)\n return \"key\", key\n end\n Enu.yield(filter)\nend\n\nfunction sleep( _nTime )\n local timer = os.startTimer( _nTime )\n while true do\n local sEvent, param = os.pullEvent( \"timer\" )\n if param == timer then return end\n end\nend\n\nos.sleep = sleep\n\n– Replacement for sleep(s), which passes on events instead of dropping them\nfunction wait(s)\n local timer = os.startTimer(s)\n while true do\n local event = {os.pullEvent()}\n if (event[1] == \"timer\" and event[2] == timer) then\n break\n else\n processMeessages(event)\n end\n end\nend","AAComCraEnuHex.lua":"Enu.Hex = {\n [\"0\"] = 0,\n [\"1\"] = 1,\n [\"2\"] = 2,\n [\"3\"] = 3,\n [\"4\"] = 4,\n [\"5\"] = 5,\n [\"6\"] = 6,\n [\"7\"] = 7,\n [\"8\"] = 8,\n [\"9\"] = 9,\n [\"a\"] = 10,\n [\"b\"] = 11,\n [\"c\"] = 12,\n [\"d\"] = 13,\n [\"e\"] = 14,\n [\"f\"] = 15\n}\n\nfunction FatalErrorHandle()\n if type(Error) ~= \"string\" then\n Error = \"Unknown error has occured!\"\n end\n term.setBackgroundColor(colors.blue)\n term.clear()\n term.setCursorPos(1, 1)\n term.setTextColour(colors.red)\n term.write(Error)\n OldPrint(Error)\n – Print Press any key to continue\n term.setTextColour(colors.orange)\n term.setCursorBlink(false)\n term.setCursorPos(1, 2)\n term.write(\"Press any key to continue\")\n –\n draw.beginframe()\n Enu.DrawFrame()\n draw.endframe()\n –sys.sleep(math.huge)\nend","AAComCraEnuPreBios.lua":"– Pre \"BIOS\" script functions.\nprint(\"Please Wait…\")\nxpcall = function(_fn, _fnErrorHandler)\n assert(type(_fn) == \"function\", \"bad argument #1 to xpcall (function expected, got \" .. type(_fn) .. \")\")\n\n local co = coroutine.create(_fn)\n local coroutineClock = os.clock()\n\n debug.sethook(co, function()\n if os.clock() >= coroutineClock + Enu.Cloc then\n print(\"Lua: Too long without yielding\")\n error(\"Too long without yielding\", 3)\n end\n local ok, err = Enu.pcall(function() end)\n if err == \"Interrupted by user\" then\n OldPrint(\"User is interrupting the script! Shutting down…\")\n error(\"Interrupted by user\")\n end\n end, \"\", Enu.Cloc)\n\n local results = {coroutine.resume(co)}\n\n debug.sethook(co)\n while coroutine.status(co) ~= \"dead\" do\n coroutineClock = os.clock()\n debug.sethook(co, function()\n if os.clock() >= coroutineClock + Enu.Cloc then\n –print(\"Lua: Too long without yielding\")\n error(\"Too long without yielding\", 3)\n end\n end, \"\", Enu.Cloc)\n\n results = {coroutine.resume(co, coroutine.yield())}\n debug.sethook(co)\n end\n\n if results[1] == true then\n return true, table.unpack(results, 2)\n else\n –Error = _fnErrorHandler(results[2])\n –OldPrint(Error)\n return false, _fnErrorHandler(results[2])\n end\nend\n\n\npcall = function(_fn, …)\n assert(type(_fn) == \"function\", \"bad argument #1 to pcall (function expected, got \" .. type(_fn) .. \")\")\n\n local args = {…}\n return xpcall(\n function()\n return _fn(table.unpack(args))\n end,\n function(_error)\n OldPrint(_error)\n return _error\n end\n )\nend\n\n– First part of filesystem functions.\nlocal fsWrite = fs.write\nfs.write = nil\n\nlocal fsAppend = fs.append\nfs.append = nil\n\nlocal fsRead = fs.read\nfs.read = nil\n\n\nfunction fs.open(path, mode, secondlayer)\n –[[if not secondlayer then\n local ok, f = pcall(fs.open, path, mode, true)\n OldPrint(ok, f)\n if ok then\n return f\n else\n path = Enu.GetPath(path)\n end\n end]]\n if mode == \"w\" then\n local f = {\n [\"_buffer\"] = \"\",\n [\"write\"] = function(str)\n f._buffer = f._buffer .. tostring(str)\n end,\n [\"writeLine\"] = function(str)\n f._buffer = f._buffer .. tostring(str) .. \"\\n\"\n end,\n [\"flush\"] = function()\n fsWrite(path, f._buffer)\n end,\n [\"close\"] = function()\n fsWrite(path, f._buffer)\n f.write = nil\n f.flush = nil\n end,\n }\n\n return f\n elseif mode == \"r\" then\n local contents = fsRead(path, \"*a\")\n local f = {\n [\"_cursor\"] = 1,\n [\"_contents\"] = contents,\n [\"readAll\"] = function()\n if not f then return contents end\n OldPrint(\"file\"..f)\n local contents = f._contents:sub(f._cursor)\n f._cursor = f._contents:len()\n return contents\n end,\n [\"readLine\"] = function()\n local nextLine = f._contents:find(\"\\n\", f._cursor, true)\n local line = f._contents:sub(f._cursor, nextLine)\n f._cursor = nextLine + 1\n return line\n end,\n [\"close\"] = function() end\n }\n\n return f\n elseif mode == \"a\" then\n local f = {\n [\"_buffer\"] = \"\",\n [\"write\"] = function(str)\n f._buffer = f._buffer .. tostring(str)\n end,\n [\"writeLine\"] = function(str)\n f._buffer = f._buffer .. tostring(str) .. \"\\n\"\n end,\n [\"flush\"] = function()\n fsAppend(path, f._buffer)\n end,\n [\"close\"] = function()\n fsAppend(path, f._buffer)\n f.write = nil\n f.flush = nil\n end,\n }\n\n return f\n else\n error(\"mode not supported\")\n end\nend","AAComCraEnu.lua":"———————\n– AAComCraEnu.lua –\n———————\n\n– AAComCraEnu.lua is the main file of code\n– that sets up the enviroment for the\n– script BIOS to run properly.\n\n———————————————–\n– Remember, functions that start with –\n– \"Enu.\" are internal script BIOS functions –\n– and should not be used in the real –\n– ComputerCraft mod for Minecraft, as they –\n– will simply error as they do not exist. –\n———————————————–\n\nunpack = function() return {} end –table.unpack\nOldPrint = print\nloadstring = load\n–[[function OldPrint(Text)\n OldPrint2(Text)\n Enu.DebugPrint[1] = Text\nend]]\n–sleep = coroutine.yield\n\nogetfenv = getfenv\n\n\nif Global then\n OldPrint = Global.Print()\n local _ENV = Global.ComputerTable[Global.CurCom][\"Env\"]\nend\n\nEnu = {}\nEnu.sleep = sleep\nEnu.time = os.time\nEnu.StartTime = Enu.time()\nEnu.Varibles = {}\ndraw.setscreen(1)\nSizeX, SizeY = draw.getport()\nEnu.XSize = 0\nEnu.YSize = 0\nEnu.CharXSize = 12\nEnu.CharYSize = 16\nEnu.ScreenText = {}\nEnu.ScreenTextColor = {}\nEnu.ScreenBGCol = {}\nEnu.DebugPrint = {}\nEnu.Font = \"Arial\"\nEnu.Cloc = 7.5*math.huge\nEnu.Advanced = true\nEnu.AdvancedError = \"Error attempting to use Advanced Computer commands\"\nEnu.Pocket = false\nEnu.pcall = pcall\n\n– Internal script BIOS function. Do not use.\nfunction Enu.TRec(X1, Y1, X2, Y2, TX, TY)\n if TX>=X1 and TX<=X2 then\n if TY>=Y1 and TY<=Y2 then\n return true\n end\n end\n return false\nend\n\nD255 = 1\/255\n– Internal script BIOS function. Do not use.\n– Used to generate correct colors for Term.\nfunction Enu.Col255(R, G, B, A)\n A = A or 255\n return {R*D255, G*D255, B*D255, A*D255}\nend\n\nrequire \"AAComCraEnuHex\"\nrequire \"AAComCraEnuPreBios3\"\nrequire \"AAComCraEnuPreBios2\"\nrequire \"AAComCraEnuPreBios\"\nrequire \"AAComCraEnuPreBios4\"\nrequire \"AAComCraEnuPreBios5\"\n–require \"AAComCraEnuShell\"\nrequire \"AAComCraEnuColors\"\nrequire \"AAComCraEnuKeyboard\"\nrequire \"AAComCraEnuKeys\"\nrequire \"Event\"\nif not Global then require \"MultiComputer\" end\nrequire \"Peripherals\"\n–require \"ABComCraEnuBasicPrograms\"\n\n– Internal script BIOS function. Do not use.\n– Resets the line with \"Text\".\nfunction Enu.ResetLine(Text)\n local String = \"\"\n Text = Text or \" \"\n for i=1, Enu.XSize do\n String = String..Text\n end\n return String\nend\n\n\n– Internal script BIOS function. Do not use.\n– Resets the entire Term with \"Text\".\nfunction Enu.ResetScreen(Text)\n local Table = {}\n for y=1, Enu.YSize do\n Table[y] = Enu.ResetLine(Text)\n end\n return Table\nend\n\n– Internal script BIOS function. Do not use.\n– Draws the Term's border.\nfunction Enu.DrawBorder(Advanced)\n local BorderColor\n if Advanced then\n BorderColor = Enu.Col255(255, 255, 96)\n else\n BorderColor = Enu.Col255(128, 128, 128)\n end\n draw.fillrect(0, 0, SizeX, SizeY - 128, BorderColor)\nend\n\n– Internal script BIOS function. Do not use.\n– Gets a term color's color value from the Script BIOS's ColorTable.\nfunction Enu.ToColor(Color)\n return Enu.ColorTable[Enu.ColorFix(Color)]\nend\n\n– Internal script BIOS function. Do not use.\nfunction Enu.DrawText()\n local ChX, ChY = Enu.CharXSize, Enu.CharYSize\n local GetChar = Enu.GetChar\n for y=1, Enu.YSize do\n for x=1, Enu.XSize do\n draw.fillrect(x*ChX, y*ChY, (x+1)*ChX, (y+1)*ChY, Enu.ToColor(Enu.ScreenBGCol[y] or Enu.CurBGCol) or draw.purple)\n draw.string(GetChar(Enu.ScreenText[y], x) or \" \", x*ChX, y*ChY, Enu.ToColor(GetChar(Enu.ScreenTextColor[y], x) or Enu.CurTextColor) or draw.white)\n end\n end\n if Enu.Blinking then\n Enu.Blink = not Enu.Blink\n local x, y = term.getCursorPos()\n if Enu.Blink then\n draw.string(\"_\", x*ChX, y*ChY, Enu.ToColor(GetChar(Enu.ScreenTextColor[y], x)))\n end\n end\nend\n\n– Internal script BIOS function. Do not use.\n– Draws the basics of the Term to the screen.\nfunction Enu.DrawFrame()\n draw.clear()\n Enu.DrawBorder(Enu.Advanced)\n Enu.DrawText()\n Enu.DrawKeyboard()\n –[[for k, v in ipairs(Enu.DebugPrint) do\n draw.string(v, 0, (SizeY - 128) + (k*16), draw.black)\n end]]\nend\n\n– Internal script BIOS function. Do not use.\n– Starts the script BIOS.\nfunction Enu.Start()\n Enu.XSize = ((SizeX) \/ Enu.CharXSize) - 2\n Enu.YSize = ((SizeY - 128) \/ Enu.CharYSize) - 2\n –Enu.XSize = 16\n Enu.ScreenText = Enu.ResetScreen(\" \")\n if Enu.Advanced then\n Enu.ScreenTextColor = Enu.ResetScreen(1)\n else\n Enu.ScreenTextColor = Enu.ResetScreen(0)\n end\n Enu.ScreenBGCol = Enu.ResetScreen(2^15)\n Enu.CurTextColor, Enu.CurBGCol = 1, 2^15\n Enu.ResetLine(\"Please Wait…\")\n local Bios = loadfile(\"AAComCraEnuBios2.lua\")\n local cbios = coroutine.create(Bios)\n local cdraw = coroutine.create(Enu.Run)\n draw.settitle(\"Bios\")\n draw.beginframe()\n Enu.DrawFrame()\n draw.endframe()\n function getfenv() end\n function setfenv() end\n App = \"\"\n –Enu.Cloc = 2\n while true do\n coroutine.resume(cbios)\n –coroutine.resume(cdraw)\n if Global then\n coroutine.yield()\n end\n sys.sleep(1)\n end\n –os.shutdown = nil\nend\n\nfunction Enu.HandleFrame()\n Enu.GameTime = os.time()\nend\n\nfunction Enu.DoFrame()\n –[[]]draw.beginframe()\n –Enu.DrawFrame()\n draw.endframe()–]]\n Enu.HandleFrame()\nend\n\nfunction Enu.Nil() end\n\nfunction Enu.Tap(TX, TY)\n if TX > SizeX - 32 and TY < 32 then\n os.shutdown()\n end\nend\n\nfunction Enu.CheckCrash(Error)\n if Error == \"Interrupted by user\" then\n os.exit()\n draw.setscreen(0)\n os.shutdown()\n error(\"Interrupted by user\")\n else\n –OldPrint(\"Tag\", Error)\n end\nend\n\nfunction Enu.Run()\n –draw.tracktouches(Enu.Nil, Enu.Nil, Enu.Tap)\n OldPrint(\"Run Started\")\n for i=1, math.huge do\n Enu.DoFrame()\n coroutine.yield()\n end\nend\n\nwhile not Enu.Shutdown do\n Enu.Start()\nend\n–Enu.DoFrame()\n–FatalErrorHandle()","AAComCraEnuKeys.lua":"keys = {}\nkeys.getName = function(ID)\n return keys.keys[ID]\nend\nlocal function AddKeys()\n local EditedString = IDString\n local Table, Table2 = {}, {}\n local Int, Tag, Name, i = 0, \"\", \"\", 0\n while #EditedString > 0 do\n i = i + 1\n local Val = string.find(EditedString, \" \")\n if Val == nil then\n keys.keys = Table\n Enu.KeyboardKeys = Table\n Enu.KeyboardText = Table2\n return\n end\n if tonumber(string.sub(EditedString, Val + 7, Val + 7)) ~= nil then\n if tonumber(string.sub(EditedString, Val + 6, Val + 6)) ~= nil then\n – if it is 3 characters\n Tag = string.sub(EditedString, Val + 5, Val + 7)\n Name = string.sub(EditedString, 2, Val)\n Int = 3\n else\n – if it is one character\n Tag = string.sub(EditedString, Val + 5, Val + 5)\n if i > 1 then\n Name = string.sub(EditedString, 2, Val)\n else\n Name = string.sub(EditedString, 1, Val)\n end\n Int = 1\n end\n else\n – if it is 2 characters\n Tag = string.sub(EditedString, Val + 5, Val + 6)\n Name = string.sub(EditedString, 2, Val)\n Int = 2\n end\n Tag = tonumber(Tag)\n Table[Tag] = \"\"\n Table2[Tag] = Name\n local StartNext = string.find(EditedString, Tag) + Int\n EditedString = string.sub(EditedString, StartNext)\n end\nend\nIDString = [[Esc 1\n1 2\n2 3\n3 4\n4 5\n5 6\n6 7\n7 8\n8 9\n9 10\n0 11\n- 12\n= 13\nBSpace 14\nTab 15\nQ 16\nW 17\nE 18\nR 19\nT 20\nY 21\nU 22\nI 23\nO 24\nP 25\n[ 26\n] 27\nEnter 28\nLCtrl 29\nA 30\nS 31\nD 32\nF 33\nG 34\nH 35\nJ 36\nK 37\nL 38\n; 39\n' 40\n~ 41\nShift 42\n\\ 43\nZ 44\nX 45\nC 46\nV 47\nB 48\nN 49\nM 50\n, 51\n. 52\n\/ 53\nRShift 54\nN * 55\nLAlt 56\nSpace 57\nCLock 58\nF1 59\nF2 60\nF3 61\nF4 62\nF5 63\nF6 64\nF7 65\nF8 66\nF9 67\nF10 68\nNuLock 69\nSLock 70\nN7 71\nN8 72\nN9 73\nN- 74\nN4 75\nN5 76\nN6 77\nN+ 78\nN1 79\nN2 80\nN3 81\nN0 82\nN . 83\nF11 87\nF12 88\nNEnter 156\nCtrl 157\nN\/ 181\nAlt 184\nHome 199\nUp 200\nPUp 201\nLeft 203\nRight 205\nEnd 207\nDown 208\nPDown 209\nInsert 210\nDel 211\n]]\nlocal NameString = [[\n* a\n* b\n* c\n* d\n* e\n* f\n* g\n* h\n* i\n* j\n* k\n* l\n* m\n* n\n* o\n* p\n* q\n* r\n* s\n* t\n* u\n* v\n* w\n* x\n* y\n* z\n* one\n* two\n* three\n* four\n* five\n* six\n* seven\n* eight\n* nine\n* zero\n* minus\n* equals\n* backspace\n* tab\n* leftBracket\n* rightBracket\n* enter\n* leftCtrl\n* semiColon\n* apostrophe\n* grave\n* leftShift\n* backslash\n* comma\n* period\n* slash\n* rightShift\n* multiply\n* leftAlt\n* space\n* capsLock\n* f1\n* f2\n* f3\n* f4\n* f5\n* f6\n* f7\n* f8\n* f9\n* f10\n* numLock\n* scollLock\n* numPad7\n* numPad8\n* numPad9\n* numPadSubtract\n* numPad4\n* numPad5\n* numPad6\n* numPadAdd\n* numPad1\n* numPad2\n* numPad3\n* numPad0\n* numPadDecimal\n* f11\n* f12\n* f13\n* f14\n* f15\n* kana\n* convert\n* noconvert\n* yen\n* numPadEquals\n* cimcumflex\n* at\n* colon\n* underscore\n* kanji\n* stop\n* ax\n* numPadEnter\n* rightCtrl\n* numPadComma\n* numPadDivide\n* rightAlt\n* pause\n* home\n* up\n* pageUp\n* left\n* right\n* end\n* down\n* pageDown\n* insert\n* delete\n]]\nAddKeys()","AAComCraEnuColors.lua":"function Enu.GetChar(String, Letter)\n return string.sub(String or \" \", Letter, Letter)\nend\n\nfunction Enu.ColorFix(Color)\n if type(Color) == \"number\" then\n if Color < 2 then\n return \"1\"\n elseif Color < 4 then\n return \"2\"\n elseif Color < 8 then\n return \"3\"\n elseif Color < 16 then\n return \"4\"\n elseif Color < 32 then\n return \"5\"\n elseif Color < 64 then\n return \"6\"\n elseif Color < 128 then\n return \"7\"\n elseif Color < 256 then\n return \"8\"\n elseif Color < 512 then\n return \"9\"\n elseif Color < 1024 then\n return \"a\"\n elseif Color < 2048 then\n return \"b\"\n elseif Color < 4096 then\n return \"c\"\n elseif Color < 8192 then\n return \"d\"\n elseif Color < 8192*2 then\n return \"e\"\n else\n return \"f\"\n end\n else\n return Color\n end\nend\n\nfunction Enu.GetNumHex(String, Le1, Le2)\n local num = 0\n String = string.sub(String, Le1, Le2)\n for i=1, #String do\n ch = tonumber(Enu.Hex[Enu.GetChar(String, i)])\n multi = 16^(#String - i)\n num = num + (ch*multi)\n end\n return num\nend\n\nfunction Enu.ColCod(String)\n local String = string.lower(String)\n local A = 255\n local R = Enu.GetNumHex(String, 1, 2)\n local G = Enu.GetNumHex(String, 3, 4)\n local B = Enu.GetNumHex(String, 5, 6)\n return {R*D255,G*D255,B*D255,A*D255}\nend\n\nEnu.ColorTable = {\n [\"1\"] = Enu.ColCod(\"F0F0F0\"), – white\n [\"2\"] = Enu.ColCod(\"F2B233\"), – orange\n [\"3\"] = Enu.ColCod(\"E57FD8\"), – magenta\n [\"4\"] = Enu.ColCod(\"99B2F2\"), – lightBlue\n [\"4\"] = Enu.ColCod(\"DEDE6C\"), – yellow\n [\"5\"] = Enu.ColCod(\"7FCC19\"), – lime\n [\"6\"] = Enu.ColCod(\"F2B2CC\"), – pink\n [\"7\"] = Enu.ColCod(\"4C4C4C\"), – gray\n [\"8\"] = Enu.ColCod(\"999999\"), – lightGray\n [\"9\"] = Enu.ColCod(\"4C9962\"), – cyan\n [\"a\"] = Enu.ColCod(\"B266E5\"), – purple\n [\"b\"] = Enu.ColCod(\"253192\"), – blue\n [\"c\"] = Enu.ColCod(\"7F664C\"), – brown\n [\"d\"] = Enu.ColCod(\"57A064\"), – green\n [\"e\"] = Enu.ColCod(\"CC4C4C\"), – red\n [\"f\"] = Enu.ColCod(\"191919\") – black\n}","Test.lua":"–You can automatically make self extracting files using this script. Compress entire folders into one file!\nlfs = require \"lfs\"\nprint(\"Finding JSON Script…\")\n\nfunction findRoot()\n local dir = \"\"\n local backADir = \"..\/\"\n while true do\n if sys.dir(dir..backADir) then\n dir = dir..backADir\n else\n break\n end\n end\n return dir\nend\n\nfunction findScript(name, path)\n path = path or findRoot()\n local dir = sys.dir(path)\n if dir then\n for k, v in pairs(dir) do\n if v~=\".\" and v~=\"..\" then\n if string.find(v, name) then\n return path..\"\/\"..v\n elseif lfs.attributes(path..\"\/\"..v, \"mode\") == \"directory\" then\n local found = findScript(name, path..\"\/\"..v..\"\/\")\n if found then\n return found\n end\n end\n end\n end\n end\n return false\nend\n\nfunction getFileContents(path)\n local file = io.open(path, \"r\")\n if file then\n local str = file:read(\"*a\")\n file:close()\n return str\n end\n return false\nend\n\nlocal directory = sys.dir()\nlocal scriptName = \"ExportFolder.lua\"\nlocal JSONScriptPath = findScript(\"JSON.lua\")\nprint(\"Found JSON Script at \"..JSONScriptPath)\nlocal JSON = load(getFileContents(JSONScriptPath))\nJSON = JSON()\n\n– Generate an extractor Script\nlocal extractScript = \"local JSONScript = [[\"..getFileContents(JSONScriptPath)..\"]]\"\nextractScript = extractScript..[[\nlocal JSON = load(JSONScript)\nJSON = JSON()\nlocal extractedFileContents = JSON.DecodeJSON(data)\nfor k, v in pairs(extractedFileContents) do\nlocal file = io.open(k, \"w\")\nfile:write(v)\nfile:close()\nend\nprint(\"Done Exporting Files\")\n]]\nlocal exportTable = {}\nfor k, v in ipairs(directory) do\n if v~=\"..\" and v~=\".\" and v~=scriptName and not string.find(v, \".png\") and not string.find(v, \"Export.lua\") then\n local file = io.open(v, \"r\")\n if file then\n exportTable[v] = file:read(\"*a\")\n file:close()\n end\n end\nend\n\nlocal contentsString = JSON.EncodeJSON(exportTable)\nextractScript = \"local data = [===========[\"..contentsString..\"]===========]\"..extractScript\n\nprint(\"Saving to Disk…\")\nlocal file = io.open(\"Export.lua\", \"w\")\nif file then\n file:write(extractScript)\n file:close()\nend","ZAboutThisEnumerator.lua":"–[[ About this File. ]]–\n———————————————-\n– Description. –\n– Lua 5.2 Minecraft ComputerCraft computer –\n– enumeration scripts. –\n———————————————-\ndraw.setscreen(1)\ndraw.clear()\nprint('You have purchased the \"Draw\" IAP.')\ndraw.setscreen(0)–[[>>>>>>>>>>>>>>>>>>>>>>>>>\n———————————————-\n– Script credits and additional credits. –\n———————————————-\n– The original creator of the –\n– \"ComputerCraft\" mod for Minecraft is –\n– Daniel Ratcliffe (or \"dan200\"). –\n– (http:\/\/www.computercraft.info\/dan200\/) –\n– Without \"dan200\" making this mod, this –\n– script would be made to enumerate –\n– something else, and thus be completely –\n– different. –\n———————————————-\n– The main editor of the enumerator –\n– scripts identifies as Matthew Cenance –\n– (or \"Tag365\"). (No link provided) –\n———————————————-\n– The BIOS script is edited slightly by –\n– \"Tag365\" to run his enumeration. –\n– (The default CC ROM scripts that are –\n– included in the folder, including the –\n– BIOS script may also have been edited.) –\n———————————————-\n\n———————————————-\n– Am I doing something that I don't have –\n– permission to do in this project? –\n– I assume I already have permission to do –\n– this project. If this is incorrect, I –\n– will stop and request for permission to –\n– continue. If I can't get permission, –\n– I will heed requests and not continue –\n– this project. –\n———————————————-\n\n———————————————-\n– I made this project to test how powerful –\n– Lua is (and how skilled I am with Lua. –\n———————————————-\n\n———————————————-\n– Original environment which my –\n– scripts were made in. –\n– This set of scripts was created in –\n– \"Touch Lua\" for iOS 7 by \"Hawwash-Soft\". –\n– This script also requires the $4.99 –\n– \"Draw\" in-app purchase to work properly. –\n———————————————-\nIf the text \"You have purchased the \"Draw\" IAP\" \nappears in the output window, then you have the\nDraw IAP and there should be no error about\nthe Draw IAP when running the actual script. \nIf not, then you either have not purchased the\nIAP or need to restore the Draw IAP. Scroll\ndown for help to fix this problem.\n———————————————-\nIf you have not purchased the \"Draw\" add-on in\nTouch Lua, you will need to purchase it.\nTo purchase the \"Draw\" in-app purchase (IAP), \nclick the \"play\" button, then click the button\nthat shows in the pop-up. Then tap the purchase\nbutton and continue with the iTunes prompts.\n———————————————-\nIf you have already purchased it, but a message\nshows on the screen that you don't have it,\ntap the button within the pop-up, then tap\n\"Restore Purchases\" and type in your iTunes \naccount address and password in the prompt\nthat appears. It will automatically restore\nthe Draw IAP and restarting this script should\nnot throw an error while running. \n———————————————-\n– Compatabilty outside the \"Touch Lua\" app –\n– is not guaranteed or supported. –\n———————————————-\n\n———————————————–\n– Warning! Do Not Use Functions with Names –\n– that Start with \"Enu.\", \"Global.\", –\n– \"draw.\", or \"Draw.\" in an actual –\n– Minecraft ComputerCraft computer script! –\n———————————————–\n– Remember, functions that start with –\n– \"Enu.\" are the internal enumerator script –\n– BIOS functions used to enumerate the –\n– ComputerCraft computer environment. –\n– They should not be used in the real –\n– ComputerCraft mod for Minecraft, as they –\n– do not exist, and will simply cause a –\n– run-time error in your script. –\n———————————————–\n\n———————————————-\n– Extra information. –\n– This project started in 2014. –\n– This project may, without warning, not –\n– worked on for any amount of time, or be –\n– discontinued. >>>>>>>>>>>>>>>>>>>>>>>>>> –\n———————————————-\n\n\n============================================\n– Thank you for reading this about file. –\n============================================]]","AAComCraEnuPreBios2.lua":"– Term API.\nterm = {}\n\n– Returns the size of the termnal.\nterm.getSize = function()\n return Enu.XSize, Enu.YSize\nend\n\n– Returns cursor postition on term.\nterm.getCursorPos = function()\n return Enu.CurX, Enu.CurY\nend\n\n– Resets cursor position to the position given by numbers \"x\" and \"y\".\nterm.setCursorPos = function(X, Y)\n Enu.CurX, Enu.CurY = X, Y\nend\n\n– Sets the cursor blinking functionality to \"blink\".\nterm.setCursorBlink = function(blink)\n Enu.Blinking = blink\nend\n\nterm.setCursorPos(1, 1)\n\nterm.IsColor = Enu.Advanced\n\n– Returns if computer is an Advanced computer or a \"Stone\" computer.\nterm.isColor = function()\n return Enu.Advanced\nend\n\n– Scrolls the term by \"Value\" lines.\nterm.scroll = function(Value)\n local sizeX, sizeY = term.getSize()\n for k=1, Value do\n table.remove(Enu.ScreenText, 1)\n table.remove(Enu.ScreenTextColor, 1)\n table.remove(Enu.ScreenBGCol, 1)\n Enu.ScreenText[sizeY] = Enu.ResetLine(\" \")\n Enu.ScreenTextColor[sizeY] = Enu.ResetLine(Enu.CurTextColor or \"0\")\n Enu.ScreenBGCol[sizeY] = Enu.ResetLine(Enu.CurBGCol or \"f\")\n end\n draw.beginframe()\n Enu.DrawFrame()\n draw.endframe()\nend\n\nterm.setTextColor = function(Color)\n if not Enu.Advanced and (Color ~= \"f\" and Color ~= \"0\") then\n error(Enu.AdvancedError)\n end\n Enu.CurTextColor = Color\nend\n\nterm.setTextColour = term.setTextColor\n\n– Unknown description.\nterm.setBackgroundColor = function(Color)\n if not Enu.Advanced and (Color ~= \"f\" and Color ~= \"0\") then\n error(Enu.AdvancedError)\n end\n Enu.CurBGCol = Color\nend\n\nterm.setBackgroundColour = term.setBackgroundColor\n\n– Internal script BIOS function. Do not use.\nfunction Enu.UpdateLine(y, noframe)\n local ChX, ChY = Enu.CharXSize, Enu.CharYSize\n local x\n if not y then\n x, y = term.getCursorPos()\n end\n if not noframe then draw.beginframe() end\n for x=1, Enu.XSize do\n draw.fillrect(x*ChX, y*ChY, (x+1)*ChX, (y+1)*ChY, Enu.ToColor(Enu.GetChar(Enu.ScreenBGCol[y], x)) or draw.black)\n draw.string(Enu.GetChar(Enu.ScreenText[y], x), x*ChX, y*ChY, Enu.ToColor(Enu.GetChar(Enu.ScreenTextColor[y], x)) or draw.white)\n end\n if not noframe then draw.endframe() end\nend\n\n– Clears the term.\nterm.clear = function()\n Enu.ScreenText = Enu.ResetScreen(\" \")\n Enu.ScreenTextColor = Enu.ResetScreen(Enu.CurTextColor or \"0\")\n Enu.ScreenBGCol = Enu.ResetScreen(Enu.CurBGCol or \"f\")\n draw.beginframe()\n Enu.DrawFrame()\n draw.endframe()\nend\n\n– Unknown description.\nterm.clearLine = function()\n local x, y = term.getCursorPos()\n Enu.ScreenText[y] = Enu.ResetLine(\" \")\n Enu.ScreenTextColor[y] = Enu.ResetLine(Enu.CurTextColor or \"0\")\n Enu.ScreenBGCol[y] = Enu.ResetLine(Enu.CurBGCol or \"f\")\n Enu.UpdateLine(y)\nend\n\n– Foreign English version of term.isColor.\nterm.isColour = term.isColor\n\n– Internal script BIOS function. Do not use.\nfunction Enu.RepeatString(String, times)\n local NewStr = String\n for i=1, times do\n NewStr = NewStr..String\n end\n return NewStr\nend\n\n– Unknown description.\nterm.write = function(text)\n local RepeatString, sub = Enu.RepeatString, string.sub\n text = tostring(text)\n local color, bgColor = Enu.CurTextColor, Enu.CurBGCol\n local x, y = term.getCursorPos()\n local text1 = RepeatString(color, #text)\n local text2 = RepeatString(bgColor, #text)\n local maxx, maxy = term.getSize()\n local begtext, endtext, beg1, beg2, end1, end2 = \"\", \"\", \"\", \"\", \"\", \"\"\n if Enu.ScreenText[y] == nil and y < maxy then\n Enu.ScreenText[y] = \"\"\n end\n if Enu.ScreenText[y] then\n begtext = sub(Enu.ScreenText[y], 0, x - 1)\n endtext = sub(Enu.ScreenText[y], x + #text)\n beg1 = sub(Enu.ScreenTextColor[y], 0, x - 1)\n end1 = sub(Enu.ScreenTextColor[y], x + #text)\n beg2 = sub(Enu.ScreenBGCol[y], 0, x - 1)\n end2 = sub(Enu.ScreenBGCol[y], x + #text)\n end\n local ws = string.match(endtext, \"^[ \\t]+\")\n if ws then\n –OldPrint(ws)\n endtext = sub(endtext, 0, #endtext - #ws)\n end\n local Text = begtext..text..endtext\n local LineCol = beg1..text1..end1\n local BGLineCol = beg2..text2..end2\n if #LineCol < maxx then\n LineCol = LineCol..RepeatString(color, (maxx - #LineCol) + 1)\n BGLineCol = BGLineCol..RepeatString(bgColor, (maxx - #BGLineCol) + 1)\n –assert(#LineCol >= Enu.XSize, \"Still missing characters\")\n end\n if #Text > (maxx) - (x - 1) then\n draw.beginframe()\n for k=1, math.ceil(#Text\/maxx) do\n if (y + (k - 1)) > maxy then\n term.scroll(1)\n y = y - 1\n end\n Enu.ScreenText[y + (k - 1)] = sub(Text, ((k-1)*maxx) + 1, k*maxx)\n Enu.ScreenTextColor[y + (k - 1)] = sub(LineCol, ((k-1)*maxx) + 1, k*maxx)..RepeatString(color, (maxx - #LineCol) + 1)\n Enu.ScreenBGCol[y + (k - 1)] = sub(BGLineCol, ((k-1)*maxx) + 1, k*maxx)..BGLineCol..RepeatString(bgColor, (maxx - #BGLineCol) + 1)\n term.setCursorPos(1, y + (k))\n Enu.UpdateLine(y + (k - 1), true)\n end\n draw.endframe()\n else\n if (y) > maxy then\n term.scroll(1)\n y = y - 1\n end\n Enu.ScreenText[y] = Text\n Enu.ScreenTextColor[y] = LineCol\n Enu.ScreenBGCol[y] = BGLineCol\n term.setCursorPos(x + #text, y)\n Enu.UpdateLine(y)\n end\nend\n\n– Prints a block of text on the termnal.\nterm.print = function(…)\n term.write(… or \"\")\n local x, y = term.getCursorPos()\n term.setCursorPos(1, y + 1)\nend\n\n– Colors API (US English).\ncolors = {}\ncolors.white = \"0\"\ncolors.orange = \"1\"\ncolors.magenta = \"2\"\ncolors.lightBlue = \"3\"\ncolors.yellow = \"4\"\ncolors.lime = \"5\"\ncolors.pink = \"6\"\ncolors.gray = \"7\"\ncolors.lightGray = \"8\"\ncolors.cyan = \"9\"\ncolors.purple = \"a\"\ncolors.blue = \"b\"\ncolors.brown = \"c\"\ncolors.green = \"d\"\ncolors.red = \"e\"\ncolors.black = \"f\"\n\n– Colour API (Foregin English).\ncolours = colors\ncolours.grey = colors.gray\ncolours.gray = nil\ncolours.lightGrey = colors.lightGray\ncolours.lightGray = nil\n\n– OS API functions.\n\n– Unknown description.\nos.getComputerID = function()\n return 1\nend\n\n– Unknown description.\nos.run = function(Table, String)\n local Shell = loadfile(String..\".lua\")\n if not Shell then\n Shell = loadfile(\"rom\/programs\/\"..String..\".lua\")\n end\n local cShell = coroutine.create(Shell)\n while true do\n OldPrint(coroutine.status(shell))\n coroutine.resume(cShell)\n –coroutine.yield()\n end\nend\n\nos.startTimer = function() end\n\n– Shuts down the computer.\nos.shutdown = function()\n term.clear()\n draw.beginframe()\n Enu.DrawFrame()\n draw.endframe()\n Enu.ShutdownNow = true\nend\n\n– Restarts the computer.\nos.reboot = function()\n term.clear()\n draw.beginframe()\n Enu.DrawFrame()\n draw.endframe()\n Enu.Start()\nend\n\nEnu.time = os.clock\n\n– Returns the current in-game time.\nos.time = function()\n local FullDay = 60*20\n return math.random(FullDay)\nend\n\n– Returns the current day.\nos.day = function()\n return 1\nend\n\n– Parallel API functions.\nparallel = {}\n\n– Runs all the functions one after another, and stops when any of them returns.\nparallel.waitForAny = function(…)\n local Functions = {…}\n local Coroutines = {}\n for k, v in ipairs(Functions) do\n Coroutines[k] = coroutine.create(v)\n end\n while true do\n for k, v in ipairs(Coroutines) do\n coroutine.yield()\n if coroutine.status(v) ~= \"dead\" then\n local ok, err = coroutine.resume(v)\n if not ok then\n OldPrint(ok, err)\n return k\n end\n else\n return k\n end\n end\n end\nend\n\n– Runs all the functions one after another, and stops when all of them have returned.\nparallel.waitForAll = function(…)\n local Functions = {…}\n local Coroutines = {}\n for k, v in ipairs(Functions) do\n Coroutines[k] = coroutine.create(v)\n end\n local TotalCoroutines = #Coroutines\n local CoroutinesRemaining = #Coroutines\n while true do\n CoroutinesRemaining = TotalCoroutines\n for k, v in ipairs(Coroutines) do\n coroutine.yield()\n if type(v) ~= \"boolean\" then\n if coroutine.status(v) ~= \"dead\" then\n local ok, err = coroutine.resume(v)\n if not ok then\n CoroutinesRemaining = CoroutinesRemaining - 1\n Coroutines[k] = true\n end\n else\n CoroutinesRemaining = CoroutinesRemaining - 1\n Coroutines[k] = true\n end\n else\n CoroutinesRemaining = CoroutinesRemaining - 1\n end\n end\n if CoroutinesRemaining <= 0 then\n return\n end\n end\nend\n\n– End of File.\n","AAComCraEnuPreBios3.lua":"– Filesystem API. –\nfs = {}\n\nEnu.St = \"computer1\/\"\nEnu.DisksFolder = \"Disks\/\"\nEnu.lfs = require \"lfs\"\n\n– Internal script BIOS function. Do not use.\nEnu.GetPath = function(Path, Rom)\n if Rom == nil then\n Rom = Enu.IsRom(Path)\n end\n if Rom == false then\n – Add a check if the computer is about to write to a Disk.\n if Enu.DrivePaths then\n for k, v in pairs(Enu.DrivePaths) do\n if type(v) == \"string\" then\n OldPrint(v..\"\/\", string.sub(Path, 0, #v + 1))\n if string.sub(Path, 0, #v + 1) == tostring(v..\"\/\") then\n local DiskID = disk.getID(k)\n OldPrint(\"About to read\/write to Disk \"..DiskID..\"…\")\n if type(sys.dir(Enu.DisksFolder)) ~= \"table\" then\n Enu.lfs.mkdir(\"Disks\")\n end\n if type(sys.dir(Enu.DisksFolder..\"disk\"..DiskID)) ~= \"table\" then\n Enu.lfs.mkdir(Enu.DisksFolder.. \"disk\"..DiskID)\n end\n return Enu.DisksFolder..\"disk\"..DiskID..\"\/\"..string.sub(Path, #v + 1)\n end\n end\n end\n end\n return Enu.St..Path\n else\n return Path\n end\nend\n\n– Internal script BIOS function. Do not use.\nEnu.IsRom = function(Path)\n if not Path then\n error()\n end\n if string.sub(Path, 0, 3) == \"rom\" then\n return true\n else\n –OldPrint(string.sub(Path, 0, 3))\n return false\n end\nend\n\n– Returns a list of all files in Path.\nfs.list = function(Path)\n if fs.isDir(Enu.St..Path) then\n return sys.dir(Enu.St..Path)\n end\nend\n\n– Checks if a path refers to an existing file or directory.\nfs.exists = function(Path)\n local FileHandle = io.open(Enu.GetPath(Path))\n if FileHandle then\n FileHandle:close()\n return true\n else\n FileHandle = io.open(Enu.GetPath(Path)..\".lua\")\n if FileHandle then\n FileHandle:close()\n return true\n else\n FileHandle = io.open(\"rom\/programs\/\"..Path)\n if FileHandle then\n FileHandle:close()\n return true\n else\n FileHandle = io.open(\"rom\/programs\/\"..Path..\".lua\")\n if FileHandle then\n FileHandle:close()\n return true\n else\n return false\n end\n end\n end\n end\nend\n\n– Checks if a path refers to an existing directory.\nfs.isDir = function(Path)\n local FileHandle = io.open(Enu.GetPath(Path))\n if FileHandle:read() == \"Folder\" then\n FileHandle:close()\n return true\n else\n FileHandle:close()\n return false\n end\nend\n\n– Checks if a path is read-only (i.e. cannot be modified).\nfs.isReadOnly = function(Path)\n\nend\n\n– Gets the storage medium holding a path, or nil if the path does not exist.\nfs.getDrive = function(Path)\n\nend\n\n– Gets the final component of a pathname.\nfs.getName = function(Path)\n local Num\n for i=1, #Path do\n if string.sub(Path, i-1, i-1) == \"\/\" then\n Num = i\n end\n end\n return string.sub(Path, Num)\nend\n\n– Gets the size of a file in bytes.\nfs.getSize = function(Path)\n local FileHandle = io.open(Enu.GetPath(Path))\n if FileHandle then\n local Size = #tostring(FileHandle.readall())\n FileHandle:close()\n return math.max(512, Size + #fs.getName(Path))\n else\n return false\n end\nend\n\n– Gets the remaining space on the drive containing the given directory.\nfs.getFreeSpace = function(Path)\n return 1024*1024\n\nend\n\n– Makes a directory.\nfs.makeDir = function(Path)\n if ToPath == \"rom\" then\n error(\"Access Denied\")\n end\n Path = Enu.GetPath(Path)\n Enu.lfs.mkdir(Path)\n – sys.dir(Path)\nend\n\n– Moves a file or directory to a new location.\nfs.move = function(FromPath, ToPath)\n if ToPath == \"rom\" or ToPath == \"sdfs\" then\n error(\"Access denied\")\n end\n os.rename(Enu.GetPath(FromPath), Enu.GetPath(ToPath))\nend\n\n– Copies a file or directory to a new location.\nfs.copy = function(FromPath, ToPath)\n if ToPath == \"rom\" then\n error(\"Access denied\")\n end\nend\n\n– Deletes a file or directory.\nfs.delete = function(Path)\n os.remove(Enu.GetPath(Path))\nend\n\n– Used for the file handling (write mode).\nfs.write = function(FileHandle, String)\n FileHandle:write(String)\nend\n\n– Used for the file handling (append mode).\nfs.append = function()\n return\nend\n\n– Used for the file handling (read mode).\nfs.read = function(Path, mode)\n local FileHandle = io.open(Enu.GetPath(Path))\n if FileHandle then\n return tostring(FileHandle:read(mode))\n else\n FileHandle = io.open(Enu.GetPath(Path)..\".lua\")\n if FileHandle then\n return tostring(FileHandle:read(mode))\n else\n FileHandle = io.open(\"rom\/programs\/\"..Path)\n if FileHandle then\n return tostring(FileHandle:read(mode))\n else\n FileHandle = io.open(\"rom\/programs\/\"..Path..\".lua\")\n if FileHandle then\n return tostring(FileHandle:read(mode))\n end\n end\n end\n end\nend\n\n– Used for the file handling (read mode).\nfs.readAll = function(FileHandle)\n return tostring(FileHandle:read(\"*a\"))\nend\n\n\n\n\n– Disk API. –\ndisk = {}\n\n– Checks whether any item is in a disk drive.\ndisk.isPresent = function(Side)\n if Enu.Peripherals[Side][\"Type\"] == \"drive\" then\n if Enu.Peripherals[Side][\"Information\"][\"DiskID\"] then\n return true\n end\n end\n return false\nend\n\n– Checks whether a Floppy Disk is in a disk drive.\ndisk.hasData = function(Side)\n if Enu.Peripherals[Side][\"Type\"] == \"drive\" then\n if Enu.Peripherals[Side][\"Information\"][\"DiskID\"] then\n if Enu.Peripherals[Side][\"Information\"][\"DiskType\"] == \"data\" then\n return true\n end\n end\n end\n return false\nend\n\n– Gets the directory name where the contents of the floppy disk can be accessed.\ndisk.getMountPath = function(Side)\n if not Enu.DrivePaths then\n Enu.DrivePaths = {}\n Enu.DrivePaths.Paths = 0\n end\n if disk.hasData(Side) then\n if Enu.DrivePaths[Side] then\n return Enu.DrivePaths[Side]\n else\n Enu.DrivePaths.Paths = Enu.DrivePaths.Paths + 1\n if Enu.DrivePaths.Paths > 1 then\n Enu.DrivePaths[Side] = tostring(\"disk\"..tostring(Enu.DrivePaths.Paths - 1))\n else\n Enu.DrivePaths[Side] = \"disk\"\n end\n return tostring(Enu.DrivePaths[Side])\n end\n end\nend\n\n– Sets the floppy disk's label.\ndisk.setLabel = function(Side, Label)\n\nend\n\n– Gets the floppy disk's label.\ndisk.getLabel = function(Side)\n return \"\"\nend\n\n– Gets the floppy disk's unique ID number.\ndisk.getID = function(Side)\n if disk.hasData(Side) then\n return Enu.Peripherals[Side][\"Information\"][\"DiskID\"]\n end\n return false\nend\n\n– Checks whether a music disk is in the drive.\ndisk.hasAudio = function(Side)\n return false\nend\n\n– Gets the title of the music disc in the drive.\ndisk.getAudioTitle = function(Side)\n return nil\nend\n\n– Starts playing the music disc in the drive.\ndisk.playAudio = function(Side)\n\nend\n\n– Stops playing the music disc in the drive.\ndisk.stopAudio = function(Side)\n\nend\n\n– Ejects any item currently in the drive, spilling it into the world as a loose item.\ndisk.eject = function(Side)\n\nend\n\n\n\n\n\n– End of File.","MultiComputer.lua":"local OldPrint = print\nOldPrint(\"Multi Computer\")\n\nlocal Computers = 0\nlocal LookFor = \"computer\"\nlocal Files = sys.dir()\nfor k, v in pairs(Files) do\n if string.sub(v, 0, #LookFor) == LookFor then\n –print(v)\n Computers = Computers + 1\n end\nend\n\nfunction Load()\n local function1, test = loadfile(\"AAComCraEnu.lua\")\n return function1\nend\n\nif not Enu then\n Global = {}\n Global.Print = print\n Global.ComputerTable = {}\n local ComputerTable = Global.ComputerTable\n Global.CurCom = 1\n Global.ActiveCom = 1\n for i=1, Computers do\n local Func = Load()\n ComputerTable = {\n [\"Run\"] = coroutine.create(Func),\n [\"Env\"] = {}\n }\n ComputerTable[\"Env\"].ComputerID = i\n end\n while true do\n for k, v in ipairs(ComputerTable) do\n Global.CurCom = k\n coroutine.resume(v[\"Run\"])\n end\n end\nend","AAComCraEnuBios.lua":"– Almost all functions are taken from the ComputerCraft bios.lua,\n– which was written by dan200\n– I just cleaned up the code a bit\n\n– I'm trying to fix it so it can run the Display as well as the actuall program\n\n\nlocal jsConsolePrint = print\n\n\nfunction os.version()\n return \"CraftOS 1.6\"\nend\n\n\nfunction os.pullEventRaw(filter)\n return filter –coroutine.yield(filter)\nend\n\n\nfunction os.pullEvent(filter)\n local eventData = {os.pullEventRaw(filter)}\n if eventData[1] == \"terminate\" then\n error(\"Terminated\", 0)\n end\n\n return unpack(eventData)\nend\n\n\nfunction sleep(time)\n local timer = os.startTimer(time)\n while true do\n local event, id = os.pullEvent(\"timer\")\n if timer == id then\n break\n end\n end\nend\n\n\nfunction write(sText)\n local w, h = term.getSize()\n local x, y = term.getCursorPos()\n\n local nLinesPrinted = 0\n local function newLine()\n if y + 1 <= h then\n term.setCursorPos(1, y + 1)\n else\n term.setCursorPos(1, h)\n term.scroll(1)\n end\n x, y = term.getCursorPos()\n nLinesPrinted = nLinesPrinted + 1\n end\n\n while string.len(sText) > 0 do\n local whitespace = string.match(sText, \"^[ \\t]+\")\n if whitespace then\n term.write(whitespace)\n x, y = term.getCursorPos()\n sText = string.sub(sText, string.len(whitespace) + 1)\n end\n\n local newline = string.match(sText, \"^\\n\")\n if newline then\n newLine()\n sText = string.sub(sText, 2)\n end\n\n local text = string.match(sText, \"^[^ \\t\\n]+\")\n if text then\n sText = string.sub(sText, string.len(text) + 1)\n if string.len(text) > w then\n while string.len(text) > 0 do\n OldPrint(x, w)\n if x > w then\n newLine()\n end\n term.write(text)\n text = string.sub(text, (w-x) + 2)\n x, y = term.getCursorPos()\n end\n else\n if x + string.len(text) - 1 > w then\n newLine()\n end\n term.write(text)\n x, y = term.getCursorPos()\n end\n end\n end\n\n return nLinesPrinted\nend\n\nwrite = term.write\n\nfunction print(…)\n local args = {…}\n local linesPrinted = 0\n for k, v in pairs(args) do\n write(tostring(k) .. \": \" .. tostring(v) .. \"\\n\")\n linesPrinted = linesPrinted + 1\n end\n\n return linesPrinted\nend\n\n\nfunction printError(…)\n if term.isColour() then\n term.setTextColour(colors.red)\n end\n\n print(…)\n term.setTextColour(colors.white)\nend\n\n\nfunction read(replaceCharacter, history)\n term.setCursorBlink(true)\n\n local line = \"\"\n local historyPos = nil\n local pos = 0\n if replaceCharacter then\n replaceCharacter = string.sub(replaceCharacter, 1, 1)\n end\n\n local w, h = term.getSize()\n local sx, sy = term.getCursorPos()\n\n local function redraw(replChar)\n local scroll = 0\n if sx + pos >= w then\n scroll = (sx + pos) - w\n end\n\n term.setCursorPos(sx, sy)\n local replace = replChar or replaceCharacter\n if replace then\n term.write(string.rep(replace, string.len(line) - scroll))\n else\n term.write(string.sub(line, scroll + 1))\n end\n term.setCursorPos(sx + pos - scroll, sy)\n end\n\n while true do\n local sEvent, param = coroutine.yield()\n if sEvent == \"char\" then\n line = string.sub(line, 1, pos) .. param .. string.sub(line, pos + 1)\n pos = pos + 1\n redraw()\n elseif sEvent == \"key\" then\n if param == 28 then\n break\n elseif param == 203 then\n if pos > 0 then\n pos = pos - 1\n redraw()\n end\n elseif param == 205 then\n if pos < string.len(line) then\n redraw(\" \")\n pos = pos + 1\n redraw()\n end\n elseif param == 200 or param == 208 then\n if history then\n redraw(\" \")\n if param == 200 then\n if historyPos == nil then\n if #history > 0 then\n historyPos = #history\n end\n elseif historyPos > 1 then\n historyPos = historyPos - 1\n end\n else\n if historyPos == #history then\n historyPos = nil\n elseif historyPos ~= nil then\n historyPos = historyPos + 1\n end\n end\n if historyPos then\n line = history[historyPos]\n pos = string.len(line)\n else\n line = \"\"\n pos = 0\n end\n redraw()\n end\n elseif param == 14 then\n if pos > 0 then\n redraw(\" \")\n line = string.sub(line, 1, pos - 1) .. string.sub(line, pos + 1)\n pos = pos - 1\n redraw()\n end\n elseif param == 199 then\n redraw(\" \")\n pos = 0\n redraw()\n elseif param == 211 then\n if pos < string.len(line) then\n redraw(\" \")\n line = string.sub(line, 1, pos) .. string.sub(line, pos + 2)\n redraw()\n end\n elseif param == 207 then\n redraw(\" \")\n pos = string.len(line)\n redraw()\n end\n end\n end\n\n term.setCursorBlink(false)\n term.setCursorPos(w + 1, sy)\n newLine()\n\n return line\nend\n\n\nloadfile = function(path)\n local file = fs.open(path, \"r\")\n if file then\n local func, err = loadstring(file.readAll(), fs.getName(path))\n file.close()\n return func, err\n end\n return nil, \"File not found\"\nend\n\n\ndofile = function(path)\n local fnFile, e = loadfile(path)\n if fnFile then\n setfenv(fnFile, getfenv(2))\n return fnFile()\n else\n error(e, 2)\n end\nend\n\n\nfunction os.run(_tEnv, _sPath, …)\n local tArgs = { … }\n local fnFile, err = loadfile(_sPath)\n if fnFile then\n local tEnv = _tEnv\n setmetatable(tEnv, { __index = _G })\n setfenv(fnFile, tEnv)\n\n local ok, err = pcall(function()\n fnFile(unpack(tArgs))\n end)\n\n if not ok then\n if err and err ~= \"\" then\n printError(err)\n end\n return false\n end\n return true\n end\n\n if err and err ~= \"\" then\n printError(err)\n end\n\n return false\nend\n\n\nlocal nativegetmetatable = getmetatable\nlocal nativetype = type\nlocal nativeerror = error\n\nfunction getmetatable(_t)\n if nativetype(_t) == \"string\" then\n nativeerror(\"Attempt to access string metatable\", 2)\n return nil\n end\n return nativegetmetatable(_t)\nend\n\n\nlocal tAPIsLoading = {}\n\nfunction os.loadAPI(_sPath)\n local sName = fs.getName(_sPath)\n if tAPIsLoading[sName] == true then\n printError(\"API \"..sName..\" is already being loaded\")\n return false\n end\n tAPIsLoading[sName] = true\n\n local tEnv = {}\n setmetatable(tEnv, { __index = _G })\n local fnAPI, err = loadfile(_sPath)\n if fnAPI then\n setfenv(fnAPI, tEnv)\n fnAPI()\n else\n printError(err)\n tAPIsLoading[sName] = nil\n return false\n end\n\n local tAPI = {}\n for k, v in pairs(tEnv) do\n tAPI[k] = v\n end\n\n _G[sName] = tAPI\n tAPIsLoading[sName] = nil\n return true\nend\n\n\nfunction os.unloadAPI(_sName)\n if _sName ~= \"_G\" and type(_G[_sName]) == \"table\" then\n _G[_sName] = nil\n end\nend\n\n\nfunction os.sleep(_nTime)\n sleep(_nTime)\nend\n\n\nlocal nativeShutdown = os.shutdown\nlocal nativeReboot = os.reboot\n\nfunction os.shutdown()\n nativeShutdown()\n while true do\n coroutine.yield()\n end\nend\n\n\nfunction os.reboot()\n nativeReboot()\n while true do\n coroutine.yield()\n end\nend\n\n\nif http then\n local function wrapRequest(_url, _post)\n local requestID = http.request(_url, _post)\n while true do\n local event, param1, param2 = os.pullEvent()\n if event == \"http_success\" and param1 == _url then\n return param2\n elseif event == \"http_failure\" and param1 == _url then\n return nil\n end\n end\n end\n\n http.get = function(_url)\n return wrapRequest(_url, nil)\n end\n\n http.post = function(_url, _post)\n return wrapRequest(_url, _post or \"\")\n end\nend\n\n\nlocal tApis = fs.list(\"rom\/apis\")\nfor n, sFile in ipairs(tApis) do\n if string.sub(sFile, 1, 1) ~= \".\" then\n local sPath = fs.combine(\"rom\/apis\", sFile)\n if not fs.isDir(sPath) then\n os.loadAPI(sPath)\n end\n end\nend\n\n\nlocal ok, err = pcall(function()\n parallel.waitForAny(\n function()\n xpcall(function()\n local c1 = coroutine.create(Shell)\n local Ok1 = true\n while Ok1 do\n Ok1, Error1 = coroutine.resume(c1)\n if not Ok1 == true then\n OldPrint(Error1)\n Enu.CheckCrash(Error1)\n return Error1\n end\n coroutine.yield()\n end\n end, Enu.CheckCrash)\n end,\n function()\n xpcall(function()\n –local c1 = coroutine.create(Enu.Run)\n local Ok1 = true\n while Ok1 do\n Ok1, Error1 = pcall(Enu.DoFrame)\n if not Ok1 == true then\n OldPrint(Error1)\n Enu.CheckCrash(Error1)\n return Error1\n end\n coroutine.yield()\n end\n end, Enu.CheckCrash)\n end)\nend)\n\n\nif not ok then\n printError(err or Error)\n Error = err\n OldPrint(Error)\nend\n\n\npcall(function()\n term.setCursorBlink(false)\n term.setTextColour(colors.red)\n term.write(\"Press any key to continue\")\n os.pullEvent(\"key\")\nend)\n\ndraw.setscreen(0)\n–os.shutdown()","Peripherals.lua":"if not Enu then require \"AAComCraEnu\" end\nperipheral = {}\n\n– load Peripheral types.\nEnu.PeripheralTypes = {}\nfor k, v in ipairs(sys.dir(\"PeripheralsFolder\")) do\n if v ~= \".\" and v ~= \"..\" then\n local FolderName = \"PeripheralsFolder\"\n local String = string.sub(v, 0, #v-4)\n OldPrint(String)\n Enu.PeripheralTypes[String] = require(FolderName..\"\/\"..String)\n end\nend\n\n– Generates the functions for an attached periphal.\nEnu.GenerateFunctions = function(Side, Type)\n local Table = Enu.PeripheralTypes[Type]\n return Table\nend\n\n– Attaches a Peripheral of type \"Type\" to side \"Side\".\nEnu.CreatePeripheral = function(Side, Type, DiskID)\n Enu.Peripherals[Side] = {}\n Enu.Peripherals[Side][\"Type\"] = Type\n Enu.Peripherals[Side][\"Functions\"] = Enu.GenerateFunctions(Side, Type)\n if Type == \"drive\" then\n Enu.Peripherals[Side][\"Information\"] = {\n [\"DiskID\"] = DiskID,\n }\n else\n Enu.Peripherals[Side][\"Information\"] = {}\n end\nend\n\n– Attaches a Peripheral of type \"drive\" to side \"Side\".\nEnu.CreateDrive = function(Side, DiskID)\n Enu.Peripherals[Side] = {}\n Enu.Peripherals[Side][\"Type\"] = \"drive\"\n Enu.Peripherals[Side][\"Functions\"] = Enu.GenerateFunctions(Side, Type)\n Enu.Peripherals[Side][\"Information\"] = {\n [\"DiskID\"] = DiskID,\n [\"DiskType\"] = \"data\",\n }\nend\n\nEnu.Peripherals = {}\n\nEnu.Peripherals[\"front\"] = false\nEnu.CreatePeripheral(\"front\", \"modem\")\nEnu.Peripherals[\"back\"] = false\nEnu.CreatePeripheral(\"back\", \"modem\")\nEnu.Peripherals[\"left\"] = false\nEnu.CreateDrive(\"left\", 1)\nEnu.Peripherals[\"right\"] = false\nEnu.CreatePeripheral(\"right\", \"printer\")\nEnu.Peripherals[\"top\"] = false\nEnu.CreatePeripheral(\"top\", \"monitor\")\nEnu.Peripherals[\"bottom\"] = false\n\n– Returns true if peripheral is present on \"side\".\nperipheral.isPresent = function(side)\n if Enu.Peripherals[side] then\n return true\n end\n return false\nend\n\n– Returns the type of peripheral connected on \"side\".\nperipheral.getType = function(side)\n if Enu.Peripherals[side] then\n return Enu.Peripherals[side][\"Type\"]\n end\n return nil\nend\n\n– Description\nperipheral.getMethods = function(side)\n\nend\n\n– Description\nperipheral.wrap = function(side)\n if Enu.Peripherals[side] then\n local type = Enu.Peripherals[side][\"type\"]\n return Enu.Peripherals[side][\"Functions\"]\n\n\n\n end\n return nil\nend\n\n\n\n\n\n\n– End of file","AAComCraEnuPreBios5.lua":"– Window API\nwindow = {}\n\ngetfenv = getfenv\n\n– Returns a terminal object that is a space within the specified parent terminal object.\nfunction window.create(parentTerm, x, y, width, height, visible)\n local newWindow = WinTerm\n newWindow.x = x\n newWindow.y = y\n newWindow.width = width\n newWindow.height = height\n newWindow.visible = visible or true\nend\n\nEnu.WinTerm = {}\nlocal WinTerm = Enu.WinTerm\n\n– Clears the screen by overwriting the whole display with blank spaces.\nfunction WinTerm.clear()\n self.screen = {}\nend\n\n– A function available to window-based terminal objects created via the window API, which toggles the visibility flag of the window in concern.\nfunction WinTerm.setVisible(visible)\n self.visible = true\n self.redraw()\nend","Mover.lua":"local Table = sys.dir()\n– add the prefixes of files you want to move to the respective folder.\nlocal Sort = {\n [\"ABComCra\"] = \"rom\/programs\",\n}\nlocal FileType = \".lua\"\nfor k, v in pairs(Table) do\n for k2, v2 in pairs(Sort) do\n if string.sub(v, 0, #k2) == k2 then\n print(v)\n os.rename(v, v2..\"\/\"..v)\n end\n end\nend\n","AAComCraEnuBios2.lua":"– Almost all functions are taken from the ComputerCraft bios.lua,\n– which was written by dan200\n\n– I just cleaned up the code a bit\n\n\nlocal jsConsolePrint = print\n\n\nfunction os.version()\n return \"CraftOS 1.6\"\nend\n\n\nfunction os.pullEventRaw(filter)\n return coroutine.yield(filter)\nend\n\nfunction unpack(T)\n local v1 = T[1]\n local v2 = T[2]\n local v3 = T[3]\n local v4 = T[4]\n return v1, v2, v3, v4, v5, v6, v7, v8\nend\n\nfunction os.pullEvent(filter)\n local eventData = {os.pullEventRaw(filter)}\n if eventData[1] == \"terminate\" then\n error(\"Terminated\", 0)\n end\n\n return unpack(eventData)\nend\n\n\nfunction sleep(time)\n local timer = os.startTimer(time)\n while true do\n local event, id = os.pullEvent(\"timer\")\n if timer == id then\n break\n end\n end\nend\n\n\nfunction write(sText)\n local w, h = term.getSize()\n local x, y = term.getCursorPos()\n\n local nLinesPrinted = 0\n local function newLine()\n if y + 1 <= h then\n term.setCursorPos(1, y + 1)\n else\n term.setCursorPos(1, h)\n term.scroll(1)\n end\n x, y = term.getCursorPos()\n nLinesPrinted = nLinesPrinted + 1\n end\n\n while string.len(sText) > 0 do\n local whitespace = string.match(sText, \"^[ \\t]+\")\n if whitespace then\n term.write(whitespace)\n x, y = term.getCursorPos()\n sText = string.sub(sText, string.len(whitespace) + 1)\n end\n\n local newline = string.match(sText, \"^\\n\")\n if newline then\n newLine()\n sText = string.sub(sText, 2)\n end\n\n local text = string.match(sText, \"^[^ \\t\\n]+\")\n if text then\n sText = string.sub(sText, string.len(text) + 1)\n if string.len(text) > w then\n while string.len(text) > 0 do\n if x > w then\n newLine()\n end\n term.write(text)\n text = string.sub(text, (w-x) + 2)\n x, y = term.getCursorPos()\n end\n else\n if x + string.len(text) - 1 > w then\n newLine()\n end\n term.write(text)\n x, y = term.getCursorPos()\n end\n end\n end\n\n return nLinesPrinted\nend\n\n\nfunction print(…)\n local args = {…}\n local linesPrinted = 0\n for k, v in pairs(args) do\n write(tostring(k) .. \": \" .. tostring(v) .. \"\\n\")\n linesPrinted = linesPrinted + 1\n end\n\n return linesPrinted\nend\n\n\nfunction printError(…)\n if term.isColor() then\n term.setTextColor(colors.red)\n end\n\n term.write(…)\n term.setTextColor(colors.white)\nend\n\n\nfunction read(replaceCharacter, history)\n term.setCursorBlink(true)\n\n local line = \"\"\n local historyPos = nil\n local pos = 0\n if replaceCharacter then\n replaceCharacter = string.sub(replaceCharacter, 1, 1)\n end\n\n local w, h = term.getSize()\n local sx, sy = term.getCursorPos()\n\n local function redraw(replChar)\n local scroll = 0\n if sx + pos >= w then\n scroll = (sx + pos) - w\n end\n\n term.setCursorPos(sx, sy)\n local replace = replChar or replaceCharacter\n if replace then\n term.write(string.rep(replace, string.len(line) - scroll))\n else\n term.write(string.sub(line, scroll + 1))\n end\n term.setCursorPos(sx + pos - scroll, sy)\n end\n\n while true do\n local sEvent, param = coroutine.yield()\n if sEvent == \"char\" then\n line = string.sub(line, 1, pos) .. param .. string.sub(line, pos + 1)\n pos = pos + 1\n redraw()\n elseif sEvent == \"key\" then\n if param == 28 then\n break\n elseif param == 203 then\n if pos > 0 then\n pos = pos - 1\n redraw()\n end\n elseif param == 205 then\n if pos < string.len(line) then\n redraw(\" \")\n pos = pos + 1\n redraw()\n end\n elseif param == 200 or param == 208 then\n if history then\n redraw(\" \")\n if param == 200 then\n if historyPos == nil then\n if #history > 0 then\n historyPos = #history\n end\n elseif historyPos > 1 then\n historyPos = historyPos - 1\n end\n else\n if historyPos == #history then\n historyPos = nil\n elseif historyPos ~= nil then\n historyPos = historyPos + 1\n end\n end\n if historyPos then\n line = history[historyPos]\n pos = string.len(line)\n else\n line = \"\"\n pos = 0\n end\n redraw()\n end\n elseif param == 14 then\n if pos > 0 then\n redraw(\" \")\n line = string.sub(line, 1, pos - 1) .. string.sub(line, pos + 1)\n pos = pos - 1\n redraw()\n end\n elseif param == 199 then\n redraw(\" \")\n pos = 0\n redraw()\n elseif param == 211 then\n if pos < string.len(line) then\n redraw(\" \")\n line = string.sub(line, 1, pos) .. string.sub(line, pos + 2)\n redraw()\n end\n elseif param == 207 then\n redraw(\" \")\n pos = string.len(line)\n redraw()\n end\n end\n end\n\n term.setCursorBlink(false)\n term.setCursorPos(w + 1, sy)\n newLine()\n\n return line\nend\n\n\nloadfile = function(path)\n –OldPrint(\"Path\", path)\n local file = fs.open(path, \"r\")\n if file then\n local String = file.readAll()\n –OldPrint(\"File Text: \"..tostring(String))\n local func, err = load(String)\n file:close()\n return func, err\n end\n return nil, \"File not found\"\nend\n\n\ndofile = function(path)\n local fnFile, e = loadfile(path)\n if fnFile then\n –setfenv(fnFile, getfenv(2))\n return fnFile()\n else\n error(e, 2)\n end\nend\n\n\nfunction os.run(_tEnv, _sPath, …)\n local tArgs = { … }\n local fnFile, err = loadfile(_sPath)\n if not fnFile then\n –OldPrint(\"Loading Lua file\"..err)\n fnFile, err = loadfile(_sPath..\".lua\")\n if not fnFile then\n fnFile, err = loadfile(\"rom\/programs\/\".._sPath)\n if not fnFile then\n fnFile, err = loadfile(\"rom\/programs\/\".._sPath..\".lua\")\n end\n end\n end\n if fnFile then\n local tEnv = _tEnv\n setmetatable(tEnv, { __index = _G })\n –setfenv(fnFile, tEnv)\n\n local ok, err = pcall(function()\n – local _ENV = tEnv\n –term.write(\"Running \".._sPath)\n fnFile(unpack(tArgs))\n end)\n –OldPrint(\"Run\", ok, err)\n\n if not ok then\n if err and err ~= \"\" then\n printError(err)\n OldPrint(_sPath, err)\n end\n return false\n end\n return true\n end\n\n if err and err ~= \"\" then\n printError(err)\n OldPrint(err)\n end\n\n return false\nend\n\n\nlocal nativegetmetatable = getmetatable\nlocal nativetype = type\nlocal nativeerror = error\n\nfunction getmetatable(_t)\n if nativetype(_t) == \"string\" then\n nativeerror(\"Attempt to access string metatable\", 2)\n return nil\n end\n return nativegetmetatable(_t)\nend\n\n\nlocal tAPIsLoading = {}\n\nfunction os.loadAPI(_sPath)\n local sName = fs.getName(_sPath)\n if tAPIsLoading[sName] == true then\n printError(\"API \"..sName..\" is already being loaded\")\n return false\n end\n tAPIsLoading[sName] = true\n\n local tEnv = {}\n setmetatable(tEnv, { __index = _G })\n local fnAPI, err = loadfile(_sPath)\n if fnAPI then\n setfenv(fnAPI, tEnv)\n fnAPI()\n else\n printError(err)\n tAPIsLoading[sName] = nil\n return false\n end\n\n local tAPI = {}\n for k, v in pairs(tEnv) do\n tAPI[k] = v\n end\n\n _G[sName] = tAPI\n tAPIsLoading[sName] = nil\n return true\nend\n\n\nfunction os.unloadAPI(_sName)\n if _sName ~= \"_G\" and type(_G[_sName]) == \"table\" then\n _G[_sName] = nil\n end\nend\n\n\nfunction os.sleep(_nTime)\n sleep(_nTime)\nend\n\n\nlocal nativeShutdown = os.shutdown\nlocal nativeReboot = os.reboot\n\nfunction os.shutdown()\n nativeShutdown()\n while true do\n coroutine.yield()\n end\nend\n\n\nfunction os.reboot()\n nativeReboot()\n while true do\n coroutine.yield()\n end\nend\n\nwrite = term.write\n\nif http then\n local function wrapRequest(_url, _post)\n local requestID = http.request(_url, _post)\n while true do\n local event, param1, param2 = os.pullEvent()\n if event == \"http_success\" and param1 == _url then\n return param2\n elseif event == \"http_failure\" and param1 == _url then\n return nil\n end\n end\n end\n\n http.get = function(_url)\n return wrapRequest(_url, nil)\n end\n\n http.post = function(_url, _post)\n return wrapRequest(_url, _post or \"\")\n end\nend\n\n\n–[[local tApis = fs.list(\"rom\/apis\")\nfor n, sFile in ipairs(tApis) do\n if string.sub(sFile, 1, 1) ~= \".\" then\n local sPath = fs.combine(\"rom\/apis\", sFile)\n if not fs.isDir(sPath) then\n os.loadAPI(sPath)\n end\n end\nend]]\n\n\n–[[if turtle then\n local tApis = fs.list(\"rom\/apis\/turtle\")\n for n, sFile in ipairs(tApis) do\n if string.sub(sFile, 1, 1) ~= \".\" then\n local sPath = fs.combine(\"rom\/apis\/turtle\", sFile)\n if not fs.isDir(sPath) then\n os.loadAPI(sPath)\n end\n end\n end\nend]]\n\nOldPrint(\"Bios is starting Shell\")\n\nlocal ok, err = pcall(function()\n OldPrint(\"Ready!\")\n getfenv = ogetfenv\n os.run({}, \"rom\/programs\/shell\")\n –[[parallel.waitForAny((function()\n os.run({}, \"rom\/programs\/shell\")\n end), (function()\n coroutine.resume(Enu.RedNetRun)\n end))]]\nend)\n\n\nif not ok then\n printError(err)\n OldPrint(\"Error\", err)\nend\n\n–os.run({}, \"rom\/programs\/shell\")\n\npcall(function()\n term.setCursorBlink(false)\n print(\"End of operation\")\n os.pullEvent(\"key\")\nend)\n\n–os.shutdown()","AAComCraEnuPreBios4.lua":"– Paint utility API. –\npaintutils = {}\n\n– Unhandled function.\npaintutils.loadImage = function(path)\n\n\nend\n\n– Unhandled function.\npaintutils.drawImage = function(path, x, y)\n\n\nend\n\n– Textutils API.\ntextutils = {}\n\n– Unknown description.\ntextutils.formatTime = function(Time, TwentyFourHour)\n return nil\nend\n\n– Rednet API. –\nrednet = {}\n\n–[[ Internal script BIOS function. Do not use.\nfunction Enu.SetupRedNet()\n if not Global then Global = {} end\n Global.RedNet = {}\n Enu.RedNetSides = {}\n Enu.RedNetRun = coroutine.create(rednet.run)\n –coroutine.resume(Enu.RedNetRun)\nend\n\n– Internal script BIOS function. Do not use.\nfunction Enu.NewRedNetMessage(Channel, Message, Protocol)\n if not Global.RedNet[Channel] then\n Global.RedNet[Channel] = {}\n end\n Global.RedNet[Channel][#Global.RedNet[Channel] + 1] = {Message, Protocol}\nend\n\n– Internal script BIOS function. Do not use.\nfunction Enu.SearchForRedNetMessage(Protocol)\n if not Global then\n Enu.SetupRedNet()\n end\n for k, v in pairs(Global.RedNet) do\n for k2, v2 in pairs(v) do\n if Protocol then\n if v2[2] == Protocol then\n return \"rednet_message\", 0, v2[1], 0\n end\n else\n return \"rednet_message\", 0, v2[1], 0\n end\n end\n end\nend\n\n– Tells the computer that the side can be used for networking.\nfunction rednet.open(Side)\nif not Global then Enu.SetupRedNet() end\n if not Global.RedNet then\n Enu.SetupRedNet()\n end\n Enu.RedNetSides[Side] = true\nend\n\n– Tells the computer that the side can no longer be used for networking.\nfunction rednet.close(Side)\ntable.remove(Enu.RedNetSides, Side)\nend\n\n– Sends a message \"intended\" for another system with a specific ID, using the currently opened sides.\nfunction rednet.send(receiverID, message, protocol)\nif type(receiverID) ~= \"number\" then\n error(\"number expected (got \"..type(receiverID)..\")\", 2)\n end\n for k, v in pairs(Enu.RedNetSides) do\n if v == true then\n Enu.NewRedNetMessage(receiverID, message, protocol)\n Enu.NewRedNetMessage(65533, message, protocol)\n return true\n end\n end\n return false\nend\n\n– Sends the message to all connected and open computers.\nfunction rednet.broadcast(message, protocol)\nfor k, v in pairs(Enu.RedNetSides) do\n if v == true then\n Enu.NewRedNetMessage(65535, message, protocol)\n return true\n end\nend\nreturn false\nend\n\n–\nfunction rednet.receive(protocolFilter, timeout)\nreturn false\n–if type(protocolFilter) == \"number\" then\n timeout = protocolFilter\n protocolFilter = nil\n end\n if not timeout then timeout = math.huge end\n local time = sys.gettime()\n for i=1, math.huge do\n if sys.gettime() - time > timeout then\n return false\n else\n local Event, Var1, Var2, Var3, Var4 – = os.pullEventRaw()\n if Event == \"rednet_message\" then\n return \"rednet_message\", 0, v2[1], 0\n end\n end\n end\nend\n\n– Unknown description.\nfunction rednet.run()\n–[[while true do\n return coroutine.yield()\n end\nend]]\n\n\n– End of File.","AAComCraEnuKeyboard.lua":"if not Enu then require \"AAComCraEnu\" return end\nEnu.KeyboardText = {\n\n}\nEnu.KeyboardKeys = {\n\n}\nfunction Enu.SetUpKeyboard()\n\nend\nfunction Enu.DrawKeyboard()\n draw.fillrect(0, SizeY - 128, SizeX, SizeY, draw.orange)\n local TotalWidthForRow, Row, odd, BGColor, YS = 0, 1, true, draw.white, 23\n for k, v in pairs(Enu.KeyboardKeys) do\n odd = not odd\n if odd then BGColor = draw.white else BGColor = draw.lightgray end\n local KeyButtonWidth = draw.stringsize(Enu.KeyboardText[k]) + 4\n TotalWidthForRow = TotalWidthForRow + KeyButtonWidth\n if TotalWidthForRow > SizeX then\n Row = Row + 1\n TotalWidthForRow = KeyButtonWidth\n draw.fillrect(0, (SizeY - 128) + ((Row - 1)*YS), TotalWidthForRow, (SizeY - 128) + (Row*YS), BGColor)\n draw.string(Enu.KeyboardText[k], 0, (SizeY - 128) + ((Row - 1)*YS), draw.black)\n else\n draw.fillrect(TotalWidthForRow - KeyButtonWidth, (SizeY - 128) + ((Row - 1)*YS), TotalWidthForRow, (SizeY - 128) + (Row*YS), BGColor)\n draw.string(Enu.KeyboardText[k], TotalWidthForRow - KeyButtonWidth, (SizeY - 128) + ((Row - 1)*YS), draw.black)\n end\n end\nend\n\nfunction Enu.HandleKeyboardFrame(TX, TY)\n local TotalWidthForRow, Row, YS = 0, 1, 23\n for k, v in pairs(Enu.KeyboardKeys) do\n local KeyButtonWidth = draw.stringsize(Enu.KeyboardText[k]) + 4\n TotalWidthForRow = TotalWidthForRow + KeyButtonWidth\n if TotalWidthForRow > SizeX then\n Row = Row + 1\n TotalWidthForRow = KeyButtonWidth\n end\n if Enu.TRec(TotalWidthForRow - KeyButtonWidth, (SizeY - 128) + ((Row - 1)*YS), TotalWidthForRow, (SizeY - 128) + (Row*YS), TX, TY) then\n Enu.CurKey = k\n –OldPrint(k)\n return k\n end\n end\n Enu.CurKey = nil\nend\n\nEnu.CharacterKeys = {\n [2] = \"1\",\n [3] = \"2\",\n [4] = \"3\",\n [5] = \"4\",\n [6] = \"5\",\n [7] = \"6\",\n [8] = \"7\",\n [9] = \"8\",\n [10] = \"9\",\n [11] = \"0\",\n [16] = \"q\",\n [17] = \"w\",\n [18] = \"e\",\n [19] = \"r\",\n [20] = \"t\",\n [21] = \"y\",\n [22] = \"u\",\n [23] = \"i\",\n [24] = \"o\",\n [25] = \"p\",\n [26] = \"[\",\n [27] = \"]\",\n [30] = \"a\",\n [31] = \"s\",\n [32] = \"d\",\n [33] = \"f\",\n [34] = \"g\",\n [35] = \"h\",\n [36] = \"j\",\n [37] = \"k\",\n [38] = \"l\",\n [39] = \";\",\n [40] = \"'\",\n [41] = \"~\",\n [43] = \"\\\\\",\n [44] = \"z\",\n [45] = \"x\",\n [46] = \"c\",\n [47] = \"v\",\n [48] = \"b\",\n [49] = \"n\",\n [50] = \"m\",\n [51] = \",\",\n [52] = \".\",\n [53] = \"\/\",\n [57] = \" \",\n}\n\nfunction Enu.read(ShowAs, History)\n local history = #History + 1\n local px, py = term.getCursorPos()\n local OldText = Enu.ScreenText[py]\n local ChX, ChY = Enu.CharXSize, Enu.CharYSize\n local EditPoint, EditLine = term.getCursorPos()\n local String, cursor, shift, capLock = \"\", px, false, false\n local Loop, flash1, flash2 = true, false, 5\n local Key = 0\n draw.tracktouches(Enu.Nil, Enu.Nil, Enu.HandleKeyboardFrame)\n local debounce = 0\n while Loop do\n debounce = debounce + 1\n if debounce > 5 then\n debounce = 0\n Enu.CurKey = nil\n –draw.doevents()\n os.pullEvent(\"Key\")\n Key = Enu.CurKey\n –OldPrint(Key)\n if Enu.CharacterKeys[Key] ~= nil then\n term.setCursorPos(EditPoint, EditLine)\n if capLock then\n String = String .. string.upper(Enu.CharacterKeys[Key])\n shift = false\n elseif shift then\n String = String .. string.upper(Enu.CharacterKeys[Key])\n shift = false\n else\n String = String .. Enu.CharacterKeys[Key]\n end\n term.write(String)\n cursor = cursor + 1\n end\n if Key == 14 then – Backspace\n term.setCursorPos(EditPoint, EditLine)\n String = string.sub(String, 0, #String - 1)\n term.write(String..\" \")\n cursor = math.max(cursor - 1, px)\n elseif Key == 28 then – Enter\n draw.clearevents()\n return String\n elseif Key == 42 then – Shift\n shift = not shift\n elseif Key == 58 then – Caps Lock\n capLock = not capLock\n elseif Key == 200 then – Up\n history = math.min(history + 1, #History + 1)\n String = History[history] or \"\"\n term.setCursorPos(1, py)\n term.clearLine()\n term.setCursorPos(1, py)\n term.write(OldText..String..\" \")\n cursor = px + #String\n elseif Key == 208 then – Down\n history = math.max(history - 1, 1)\n String = History[history] or \"\"\n term.setCursorPos(px + 1, py)\n term.clearLine()\n term.setCursorPos(1, py)\n term.write(OldText..String..\" \")\n cursor = px + #String\n end\n if flash1 then\n –[[draw.beginframe()\n draw.string(\"_\", cursor*ChX, EditLine*ChY, Enu.ToColor(Enu.CurTextColor) or draw.white)\n draw.endframe()]]\n end\n flash1 = not flash1\n –coroutine.yield()\n end\n end\n print()\n return String\nend","ColorFix.lua":"function Enu.ColorFix(Color)\n if Color < 2 then\n return \"1\"\n elseif Color < 4 then\n return \"2\"\n else\n return string.sub(tostring(math.sqrt(Color)))\n end\nend"}]===========]local JSONScript = [[
local t = {}



————————————————————————————————————————
————————————————————————————————————————
————————————————————————————————————————
————————————————JSON Functions Begin—————————————————-
————————————————————————————————————————
————————————————————————————————————————
————————————————————————————————————————

–JSON Encoder and Parser for Lua 5.1

–Copyright 2007 Shaun Brown (http://www.chipmunkav.com)
–All Rights Reserved.

–Permission is hereby granted, free of charge, to any person
–obtaining a copy of this 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.
–If you find this software useful please give www.chipmunkav.com a mention.

–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.

local string = string
local math = math
local table = table
local error = error
local tonumber = tonumber
local tostring = tostring
local type = type
local setmetatable = setmetatable
local pairs = pairs
local ipairs = ipairs
local assert = assert
local Chipmunk = Chipmunk


local StringBuilder = {
buffer = {}
}

function StringBuilder:New()
local o = {}
setmetatable(o, self)
self.__index = self
self.si = 0
o.buffer = {}
return o
end

function StringBuilder:Append(s)
self.buffer[#self.buffer+1] = s
end

function StringBuilder:ToString()
return table.concat(self.buffer)
end

local JsonWriter = {
backslashes = {
['\b'] = "\\b",
['\t'] = "\\t",
['\n'] = "\\n",
['\f'] = "\\f",
['\r'] = "\\r",
['"'] = "\\\"",
['\\'] = "\\\\",
['/'] = "\\/"
}
}

function JsonWriter:New(pg)
local o = {}
o.writer = StringBuilder:New()
setmetatable(o, self)
self.__index = self
self.pg = pg
return o
end

function JsonWriter:Append(s)
self.writer:Append(s)
end

function JsonWriter:ToString()
return self.writer:ToString()
end

function JsonWriter:Write(o)
local t = type(o)
if t == "nil" then
self:WriteNil()
elseif t == "boolean" then
self:WriteString(o)
elseif t == "number" then
self:WriteString(o)
elseif t == "string" then
self:ParseString(o)
elseif t == "table" then
self:WriteTable(o)
elseif t == "function" then
self:WriteFunction(o)
elseif t == "thread" then
self:WriteError(o)
elseif t == "userdata" then
self:WriteError(o)
end
end

function JsonWriter:WriteNil()
self:Append("null")
end

function JsonWriter:WriteString(o)
self:Append(tostring(o))
end

function JsonWriter:ParseString(s)
self:Append('"')
self:Append(string.gsub(s, "[%z%c\\\"/]", function(n)
local c = self.backslashes[n]
if c then return c end
return string.format("\\u%.4X", string.byte(n))
end))
self:Append('"')
end

function JsonWriter:IsArray(t)
local count = 0
local isindex = function(k)
if type(k) == "number" and k > 0 then
if math.floor(k) == k then
return true
end
end
return false
end
for k,v in pairs(t) do
if self.pg ~= nil then self.pg(k, #t) end
if not isindex(k) then
return false, '{', '}'
else
count = math.max(count, k)
end
end
return true, '[', ']', count
end

function JsonWriter:WriteTable(t)
local ba, st, et, n = self:IsArray(t)
self:Append(st)
if ba then
for i = 1, n do
self:Write(t)
if i < n then
self:Append(',')
end
end
else
local first = true;
for k, v in pairs(t) do
if self.pg ~= nil then self.pg(k, #t, v) end
if not first then
self:Append(',')
end
first = false;
self:ParseString(k)
self:Append(':')
self:Write(v)
end
end
self:Append(et)
end

function JsonWriter:WriteError(o)
error(string.format(
"Encoding of %s unsupported",
tostring(o)))
end

function JsonWriter:WriteFunction(o)
if o == Null then
self:WriteNil()
else
self:WriteError(o)
end
end

local StringReader = {
s = "",
i = 0
}

function StringReader:New(s)
local o = {}
setmetatable(o, self)
self.__index = self
o.s = s or o.s
return o
end

function StringReader:Peek()
local i = self.i + 1
if self.pg ~= nil then self.pg(self.i, #self.s) end
if i <= #self.s then
return string.sub(self.s, i, i)
end
return nil
end

function StringReader:Next()
self.i = self.i+1
if self.i <= #self.s then
return string.sub(self.s, self.i, self.i)
end
return nil
end

function StringReader:All()
return self.s
end

local JsonReader = {
escapes = {
['t'] = '\t',
['n'] = '\n',
['f'] = '\f',
['r'] = '\r',
['b'] = '\b',
}
}

function JsonReader:New(s, pg)
local o = {}
o.reader = StringReader:New(s)
setmetatable(o, self)
self.__index = self
self.s = s
return o;
end

function JsonReader:Read()
if self.li == nil then self.li = 0 end
self:SkipWhiteSpace()
local peek = self:Peek()
if peek == nil then
error(string.format(
"Nil string: '%s'",
self:All()))
elseif peek == '{' then
return self:ReadObject()
elseif peek == '[' then
return self:ReadArray()
elseif peek == '"' then
return self:ReadString()
elseif string.find(peek, "[%+%-%d]") then
return self:ReadNumber()
elseif peek == 't' then
return self:ReadTrue()
elseif peek == 'f' then
return self:ReadFalse()
elseif peek == 'n' then
return self:ReadNull()
elseif peek == '/' then
self:ReadComment()
return self:Read()
else
return nil
end
end

function JsonReader:ReadTrue()
self:TestReservedWord{'t','r','u','e'}
return true
end

function JsonReader:ReadFalse()
self:TestReservedWord{'f','a','l','s','e'}
return false
end

function JsonReader:ReadNull()
self:TestReservedWord{'n','u','l','l'}
return nil
end

function JsonReader:TestReservedWord(t)
for i, v in ipairs(t) do
if self:Next() ~= v then
error(string.format(
"Error reading '%s': %s",
table.concat(t),
self:All()))
end
end
end

function JsonReader:ReadNumber()
local result = self:Next()
local peek = self:Peek()
while peek ~= nil and string.find(
peek,
"[%+%-%d%.eE]") do
result = result .. self:Next()
peek = self:Peek()
end
result = tonumber(result)
if result == nil then
error(string.format(
"Invalid number: '%s'",
result))
else
return result
end
end

function JsonReader:ReadString()
local result = ""
assert(self:Next() == '"')
–self.si = 0
while self:Peek() ~= '"' do
self.si = self.si + 1
local ch = self:Next()
if ch == '\\' then
ch = self:Next()
if self.escapes[ch] then
ch = self.escapes[ch]
end
end
result = result .. ch
end
assert(self:Next() == '"')
local fromunicode = function(m)
return string.char(tonumber(m, 16))
end
return string.gsub(
result,
"u%x%x(%x%x)",
fromunicode)
end

function JsonReader:ReadComment()
assert(self:Next() == '/')
local second = self:Next()
if second == '/' then
self:ReadSingleLineComment()
elseif second == '*' then
self:ReadBlockComment()
else
error(string.format(
"Invalid comment: %s",
self:All()))
end
end

function JsonReader:ReadBlockComment()
local done = false
while not done do
self.si = self.si + 1
local ch = self:Next()
if ch == '*' and self:Peek() == '/' then
done = true
end
if not done and
ch == '/' and
self:Peek() == "*" then
error(string.format(
"Invalid comment: %s, '/*' illegal.",
self:All()))
end
end
self:Next()
end

function JsonReader:ReadSingleLineComment()
local ch = self:Next()
while ch ~= '\r' and ch ~= '\n' do
ch = self:Next()
end
end

function JsonReader:ReadArray()
local result = {}
assert(self:Next() == '[')
local done = false
if self:Peek() == ']' then
done = true;
end
if not self.si then self.si = 0 end
while not done do
self.si = self.si + 1
local item = self:Read()
result[#result+1] = item
self:SkipWhiteSpace()
if self:Peek() == ']' then
done = true
end
if not done then
local ch = self:Next()
if ch ~= ',' then
error(string.format(
"Invalid array: '%s' due to: '%s'",
self:All(), ch))
end
end
end
assert(']' == self:Next())
return result
end

function JsonReader:ReadObject()
local result = {}
assert(self:Next() == '{')
local done = false
if self:Peek() == '}' then
done = true
end
if not self.si then self.si = 0 end
while not done do
self.si = self.si + 1
local key = self:Read()
if type(key) ~= "string" then
error(string.format(
"Invalid non-string object key: %s",
key))
end
self:SkipWhiteSpace()
local ch = self:Next()
if ch ~= ':' then
error(string.format(
"Invalid object: '%s' due to: '%s'",
self:All(),
ch))
end
self:SkipWhiteSpace()
local val = self:Read()
result[key] = val
self:SkipWhiteSpace()
if self:Peek() == '}' then
done = true
end
if not done then
ch = self:Next()
if ch ~= ',' then
error(string.format(
"Invalid array: '%s' near: '%s'",
self:All(),
ch))
end
end
end
assert(self:Next() == "}")
return result
end

function JsonReader:SkipWhiteSpace()
local p = self:Peek()
while p ~= nil and string.find(p, "[%s/]") do
if p == '/' then
self:ReadComment()
else
self:Next()
end
p = self:Peek()
end
end

function JsonReader:Peek()
return self.reader:Peek()
end

function JsonReader:Next()
return self.reader:Next()
end

function JsonReader:All()
return self.reader:All()
end

function Encode(o, pg)
local writer = JsonWriter:New(pg)
writer.pg = pg
writer:Write(o, pg)
return writer:ToString()
end

function Decode(s, pg)
local reader = JsonReader:New(s, pg)
return reader:Read()
end

function Null()
return Null
end
——————– End JSON Parser ————————


t.DecodeJSON = function(jsonString, ProgFun)
if type(jsonString) == "string" then
return Decode(jsonString, ProgFun)
end
print("RbxUtil.DecodeJSON expects string argument!")
return nil
end

t.EncodeJSON = function(jsonTable, ProgFun)
return Encode(jsonTable, ProgFun)
end

return t
]]local JSON = load(JSONScript)
JSON = JSON()
local extractedFileContents = JSON.DecodeJSON(data)
for k, v in pairs(extractedFileContents) do
local file = io.open(k, "w")
file:write(v)
file:close()
end
print("Done Exporting Files")


–By the way, here is the link to the Touch Lua app if you want to download it.
https://itunes.apple.com/us/app/touch-lua/id525273327?mt=8
–And here is the official forums for Touch Lua.
http://hawwashsoft.proboards.com
Lupus590 #2
Posted 11 May 2015 - 02:53 PM
code tags and spoiler tags will help us understand your post

remove the dots
[.code][./code]
[.spoiler][./spoiler]
Edited on 11 May 2015 - 12:54 PM
Creator #3
Posted 11 May 2015 - 06:03 PM
And pastebin please