Sent Lua random utilities/Source code prototype/20

-- Define variables code = {} -- The code Sent Lua will execute logs = {} -- Some logs doing = 0 -- The current line we're doing status = 6 -- The status of the compilation

olr = {} -- One line ram ram = {} -- Many line ram i = 0 -- i, Index, used in loops installed = {} -- All installed modules currently

hasComment = false -- Whether the line we're doing has a comment module = "" -- The module of the given line command = "" -- The command of the given line params = {} -- The parameters of the given line

-- Configs which shouldn't really be changed but ok useStrictMode = false deleteIndents = true maxCodeLength = 10000

showLogs = false showErrors = true showStatusOnEnd = true

-- Define modules modules = { "sys", "main", "math", "tt", "time", }

-- Get code (temporary) code = {"install.hel","hel.boringly","   yosimite"}

-- Logging functions function log(message) table.insert(logs,message) if showLogs then print(message) end end

function error(message) table.insert(logs,message) if showErrors then print("Error at line " .. doing .. ": \n " .. message) end end

-- Generic table functions function tableLength(table) local count = 0 for i in pairs(table) do   count = count + 1 end return count end

codelen = tableLength(code) -- The length of the code given

if codelen > maxCodeLength then error("Code is too long, max length is " .. maxCodeLength .. ". Proceeding to not execute following code.") return end

function displayTable(table) for i in pairs(table) do     print(table[i]) end end

-- Config checks if useStrictMode then error("Strict mode is currently not available yet.") return end if deleteIndents then for i in pairs(code) do   code[i] = code[i]:gsub("%s*","") end end

-- Generic but pretty useful functions function strSplit(inputstr,sep) local t = {} for str in string.gmatch(inputstr, "([^"..sep.."]+)") do   table.insert(t, str) end return t end

repeat -- Increment the current line doing = doing + 1 hasComment = false

-- Get module, command, and params params = strSplit(code[doing],".") module = params[1] command = params[2] table.remove(params,1) table.remove(params,2) if module == nil then module = "main" end if command == nil then command = "main" end -- Check if a module is requested to be installed or the given module is installed -- if module == "install" then --   table.insert(installed,command) --   return -- end -- if installed[module] == nil then --   error("Module " .. module .. " is not installed.") -- end -- TEMPORARY - IT DOESNT WORK YET -- Is it a coating -- TEMPORARY - NOT IMPLEMENTED YET

-- Run the actual command if module == "main" then -- TEMP end until doing >= codelen