e
This commit is contained in:
@@ -8,7 +8,7 @@ function object.getMachineEvent()
|
||||
return nil
|
||||
end
|
||||
local event = INTERNAL_EVENT_QUEUE[1]
|
||||
INTERNAL_EVENT_QUEUE[1]=nil
|
||||
INTERNAL_EVENT_QUEUE={table.unpack(INTERNAL_EVENT_QUEUE, 2)}
|
||||
return table.unpack(event)
|
||||
end
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@ local fss = {}
|
||||
local object = {}
|
||||
local uObject = {}
|
||||
|
||||
local function getFs(self)
|
||||
return fss[tostring(self.__UDATA_id)]
|
||||
local function getFs(disk)
|
||||
return fss[tostring(disk.__UDATA_id)]
|
||||
end
|
||||
|
||||
local function normalize(path)
|
||||
@@ -75,23 +75,25 @@ end
|
||||
function uObject:readBytes(start, length)
|
||||
local f = getFs(self)
|
||||
local file=fs.open(f, "r")
|
||||
local data=fs.readAll()
|
||||
local data=file.readAll()
|
||||
file.close()
|
||||
return data:sub(start, start+length)
|
||||
return data:sub(start+1, start+length)
|
||||
end
|
||||
|
||||
function uObject:writeBytes(start, dat)
|
||||
local f = getFs(self)
|
||||
local file=fs.open(f, "r")
|
||||
local data=fs.readAll()
|
||||
local data=file.readAll()
|
||||
file.close()
|
||||
file = fs.open(f, "w")
|
||||
file.write(data:sub(1, start)..dat..data:sub(start+1+#dat, #data))
|
||||
file.close()
|
||||
return data:sub(1, start)..dat..data:sub(start+#dat, #data)
|
||||
end
|
||||
|
||||
function uObject:getSize()
|
||||
local f = getFs(self)
|
||||
local file=fs.open(f, "r")
|
||||
local data=fs.readAll()
|
||||
local data=file.readAll()
|
||||
file.close()
|
||||
return #data
|
||||
end
|
||||
|
||||
4
AceVM/components/keys.lua
Normal file
4
AceVM/components/keys.lua
Normal file
@@ -0,0 +1,4 @@
|
||||
akeys = {}
|
||||
akeys[keys.enter] = "\n"
|
||||
akeys[keys.tab] = "\t"
|
||||
akeys[keys.backspace] = "\b"
|
||||
@@ -1,6 +1,6 @@
|
||||
local screen = {}
|
||||
|
||||
local function write(sText)
|
||||
function write(sText)
|
||||
local w, h = term.getSize()
|
||||
local x, y = term.getCursorPos()
|
||||
|
||||
@@ -56,7 +56,7 @@ local function write(sText)
|
||||
return nLinesPrinted
|
||||
end
|
||||
|
||||
function screen.print(...)
|
||||
function print(...)
|
||||
local nLinesPrinted = 0
|
||||
local nLimit = select("#", ...)
|
||||
for n = 1, nLimit do
|
||||
@@ -69,7 +69,11 @@ function screen.print(...)
|
||||
nLinesPrinted = nLinesPrinted + write("\n")
|
||||
end
|
||||
|
||||
function screen.printInline(...)
|
||||
function screen.print(...)
|
||||
print(...)
|
||||
end
|
||||
|
||||
function printInline(...)
|
||||
local nLinesPrinted = 0
|
||||
local nLimit = select("#", ...)
|
||||
for n = 1, nLimit do
|
||||
@@ -77,8 +81,12 @@ function screen.printInline(...)
|
||||
nLinesPrinted = nLinesPrinted + write(s)
|
||||
end
|
||||
end
|
||||
function screen.printInline(...)
|
||||
printInline(...)
|
||||
end
|
||||
|
||||
function screen.clear()
|
||||
term.setCursorPos(1,1)
|
||||
term.clear()
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user