v1.7.0 - Fixed up some more stuff, changed how print() works, added to automatically load all libraries in lua shell.

This commit is contained in:
TheWahlolly
2025-05-23 18:25:23 +03:00
parent 91d9ebecb1
commit b3f1431bda
8 changed files with 43 additions and 28 deletions
+12 -3
View File
@@ -1,14 +1,23 @@
print("\27[44m".._VERSION.."\27[0m shell")
print('Type "exit" to exit.')
termlib.readHistory["lua"] = {""}
local fs = import("filesystem")
local loadedLibraries = ""
local libList = fs.list("halyde/lib")
for _, lib in pairs(libList) do
if lib:match("(.+)%.lua") then
loadedLibraries = loadedLibraries .. "local " .. lib:match("(.+)%.lua") .. ' = import("' .. lib:match("(.+)%.lua") .. '")\n'
end
end
while true do
print("\27[44mlua>\27[0m ", false)
local command = read("lua")
local command = read("lua", "\27[44mlua>\27[0m ")
if command == "exit" then
return
else
local function runCommand()
assert(load(command))()
assert(load(loadedLibraries .. command))()
end
local result, reason = xpcall(runCommand, function(errMsg)
return errMsg .. "\n\n" .. debug.traceback()