diff --git a/sys/apis/util.lua b/sys/apis/util.lua index 7f87230..29a865e 100644 --- a/sys/apis/util.lua +++ b/sys/apis/util.lua @@ -296,6 +296,13 @@ function Util.filter(it, f) return ot end +function Util.reduce(t, fn, acc) + for _, v in pairs(t) do + fn(acc, v) + end + return acc +end + function Util.size(list) if type(list) == 'table' then local length = 0 diff --git a/sys/apps/Network.lua b/sys/apps/Network.lua index 49aeed5..39cb2ce 100644 --- a/sys/apps/Network.lua +++ b/sys/apps/Network.lua @@ -206,7 +206,7 @@ function page.grid:getDisplayValues(row) end end if row.fuel then - row.fuel = Util.toBytes(row.fuel) + row.fuel = row.fuel > 0 and Util.toBytes(row.fuel) or '' end if row.distance then row.distance = Util.round(row.distance, 1) diff --git a/sys/apps/shell b/sys/apps/shell index 69f8ca5..1bcece8 100644 --- a/sys/apps/shell +++ b/sys/apps/shell @@ -80,15 +80,6 @@ end local function createShellEnv(sDir) local tEnv = setmetatable(Util.shallowCopy(sandboxEnv), { __index = _G }) - --[[ - package.path = "?;?.lua;?/init.lua;/rom/modules/main/?;/rom/modules/main/?.lua;/rom/modules/main/?/init.lua" - if turtle then - package.path = package.path..";/rom/modules/turtle/?;/rom/modules/turtle/?.lua;/rom/modules/turtle/?/init.lua" - elseif command then - package.path = package.path..";/rom/modules/command/?;/rom/modules/command/?.lua;/rom/modules/command/?/init.lua" - end - ]] - local package package = { @@ -106,7 +97,6 @@ local function createShellEnv(sDir) preload = { }, loaders = { function( name ) -_G._p = _ENV if package.preload[name] then return package.preload[name] else diff --git a/sys/network/redserver.lua b/sys/network/redserver.lua index fda019c..8da25a4 100644 --- a/sys/network/redserver.lua +++ b/sys/network/redserver.lua @@ -79,6 +79,7 @@ local function getListing(path, recursive) return list end +--[[ Event.on('modem_message', function(_, _, dport, dhost, request) if dport == 80 and dhost == computerId and type(request) == 'table' then if request.method == 'GET' then @@ -111,3 +112,4 @@ Event.on('modem_message', function(_, _, dport, dhost, request) end end end) +]]