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:
@@ -1,8 +1,7 @@
|
||||
local args = {...}
|
||||
local file = args[1]
|
||||
args = nil
|
||||
local file = ...
|
||||
local fs = import("filesystem")
|
||||
local event = import("event")
|
||||
local component = import("component")
|
||||
local gpu = component.proxy(component.list("gpu")())
|
||||
local width, height = gpu.getResolution()
|
||||
local scrollPosX, scrollPosY = 1, 1
|
||||
@@ -16,7 +15,7 @@ local scrollSpeed = 5
|
||||
local function rawset(x, y, text)
|
||||
termlib.cursorPosX = x
|
||||
termlib.cursorPosY = y
|
||||
print(text, false, false)
|
||||
termlib.write(text, false)
|
||||
end
|
||||
|
||||
local filestring, filepath, handle, data, tmpdata
|
||||
|
||||
@@ -3,11 +3,11 @@ local computer = import("computer")
|
||||
|
||||
local function printstat(text)
|
||||
termlib.cursorPosX = 35
|
||||
print(text, true, false)
|
||||
termlib.write(text .. "\n", false)
|
||||
end
|
||||
|
||||
print(_OSLOGO, true, false)
|
||||
termlib.cursorPosY = termlib.cursorPosY - 18
|
||||
termlib.write(_OSLOGO, false)
|
||||
termlib.cursorPosY = termlib.cursorPosY - 17
|
||||
printstat("\27[92mOS\27[0m: ".._OSVERSION)
|
||||
printstat("\27[92mArchitecture\27[0m: ".._VERSION)
|
||||
local componentCounter = 0
|
||||
|
||||
+12
-3
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user