make sleep work
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
|
||||
function string.hasSuffix(str, suffix)
|
||||
return string.sub(str, #suffix+1) == suffix
|
||||
end
|
||||
@@ -195,7 +194,10 @@ end
|
||||
|
||||
local oldtype=type
|
||||
local oldgetmetatable=getmetatable
|
||||
function type(object)
|
||||
function type(object, trueType)
|
||||
if trueType then
|
||||
return oldtype(object)
|
||||
end
|
||||
if oldtype(object)~="table" then
|
||||
return oldtype(object)
|
||||
else
|
||||
@@ -225,7 +227,7 @@ function getmetatable(object)
|
||||
end
|
||||
end
|
||||
|
||||
function isEqual(a, ...)
|
||||
function isEqualToAny(a, ...)
|
||||
local args={...}
|
||||
for i=0, #args do
|
||||
if a==args[i] then
|
||||
@@ -235,6 +237,16 @@ function isEqual(a, ...)
|
||||
return false
|
||||
end
|
||||
|
||||
function isEqualToAll(a, ...)
|
||||
local args={...}
|
||||
for i=0, #args do
|
||||
if a~=args[i] then
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function table.keys(t)
|
||||
local a = {}
|
||||
for n in pairs(t) do table.insert(a, n) end
|
||||
@@ -256,15 +268,17 @@ function table.indexOf(t, value)
|
||||
return -1
|
||||
end
|
||||
|
||||
syscall = setmetatable({}, {__index = function(self, name)
|
||||
return function(...)
|
||||
local res = table.pack(coroutine.yield("syscall", name, ...))
|
||||
if res[1] then
|
||||
return table.unpack(res, 2, res.n)
|
||||
else
|
||||
error(res[2], 2)
|
||||
syscall = setmetatable({}, {
|
||||
__index = function(self, name)
|
||||
return function(...)
|
||||
local res = table.pack(coroutine.yield("syscall", name, ...))
|
||||
if res[1] then
|
||||
return table.unpack(res, 2, res.n)
|
||||
else
|
||||
error(res[2], 2)
|
||||
end
|
||||
end
|
||||
end
|
||||
end})
|
||||
})
|
||||
|
||||
table.serialize=serialize
|
||||
@@ -144,30 +144,6 @@ data["eeprom"] = {
|
||||
end
|
||||
}
|
||||
|
||||
data["stdin"] = {
|
||||
type = "link",
|
||||
read = function(amount)
|
||||
return kernel.currentTask.fd[0].read(amount)
|
||||
end,
|
||||
write = function() error("Permission denied") end
|
||||
}
|
||||
|
||||
data["stdout"] = {
|
||||
type = "link",
|
||||
read = function() error("Permission denied") end,
|
||||
write = function(data)
|
||||
kernel.currentTask.fd[1].write(data)
|
||||
end
|
||||
}
|
||||
|
||||
data["stderr"] = {
|
||||
type = "link",
|
||||
read = function() error("Permission denied") end,
|
||||
write = function(data)
|
||||
kernel.currentTask.fd[2] = data
|
||||
end
|
||||
}
|
||||
|
||||
local keyboard = kernel.newFifo()
|
||||
local mouse = kernel.newFifo()
|
||||
data["input"] = newDirectory()
|
||||
|
||||
Reference in New Issue
Block a user