forked from Hyperion/HyperionOS
super dupper system update (it runs)
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
local args={...}
|
||||
local kernel=args[1]
|
||||
function string.hasSuffix(str, suffix)
|
||||
return string.sub(str, #suffix+1) == suffix
|
||||
end
|
||||
@@ -158,6 +156,8 @@ local function serialize(table)
|
||||
local coma=true
|
||||
if type(i) == "string" then
|
||||
output=output.."[\""..i.."\"]="
|
||||
elseif type(i) == "number" then
|
||||
output=output.."["..tostring(i).."]="
|
||||
end
|
||||
if type(v) == "table" then
|
||||
if v == table then
|
||||
@@ -194,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
|
||||
@@ -224,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
|
||||
@@ -234,5 +237,48 @@ function isEqual(a, ...)
|
||||
return false
|
||||
end
|
||||
|
||||
table.serialize=serialize
|
||||
kernel.log("Loaded stdlib")
|
||||
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
|
||||
return a
|
||||
end
|
||||
|
||||
function table.values(t)
|
||||
local a = {}
|
||||
for _, n in pairs(t) do table.insert(a, n) end
|
||||
return a
|
||||
end
|
||||
|
||||
function table.indexOf(t, value)
|
||||
for i,v in ipairs(t) do
|
||||
if v==value then
|
||||
return i
|
||||
end
|
||||
end
|
||||
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)
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
table.serialize=serialize
|
||||
Reference in New Issue
Block a user