mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-16 10:51:55 -04:00
Merge branch 'master-MC1.7.10' of github.com:MightyPirates/OpenComputers into master-MC1.8.9
This commit is contained in:
commit
4a47b04e56
@ -12,6 +12,6 @@ This will allow you to call all of the functions provided by the [redstone](../i
|
||||
|
||||
`rs.setOutput(require("sides").front, 15)`
|
||||
|
||||
**Important**: when working in the Lua interpreter, *do not* use `local`, as that will make the variables local to a single line of input. Meaning if you were to enter the lines above one after another in the interpreter, the third one would error, telling you that `rs` is a `nil` value. Why only on the third line, you ask? Because, for ease of testing, the interpreter tries to load unknown variables as libraries. So even though the assignment to `component` from the first line would nothing, the use of `component` on the second line would cause that library to be loaded and used. Libraries are not automatically used when using Lua scripts to keep memory usage low, because that's a limited resource.
|
||||
**Important**: when working in the Lua interpreter, *do not* use `local`, as that will make the variables local to a single line of input. Meaning if you were to enter the lines above one after another in the interpreter, the third one would error, telling you that `rs` is a `nil` value. Why only on the third line, you ask? Because, for ease of testing, the interpreter tries to load unknown variables as libraries. So even though the assignment to `component` from the first line would do nothing, the use of `component` on the second line would cause that library to be loaded and used. Libraries are not automatically used when using Lua scripts to keep memory usage low, because that's a limited resource.
|
||||
|
||||
OpenOS provides many custom libraries which can be used for many applications, from controlling and manipulating components attached to the [computer](computer.md), to reference APIs for colors used in bundled redstone control and [keyboard](../block/keyboard.md) keycodes. Custom libraries can be used within a Lua script by using the `require()` function, as above. Some custom libraries require specific components to work, such as the `internet` library requiring an [internet card](../item/internetCard.md). In that particular case it is even being provided by it, i.e. the library will show up once you install an internet card - technically speaking, it is contained on a small, read-only file system on the internet card.
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||

|
||||
|
||||
Servers are a form of higher tier [computer](../general/computer.md). They can be configured by holding them in the hand and using them - like opening a backpack or Ender pouch, for example. The can also be configured after having been installed into a [rack](../block/rack.md) by activating them (aiming at the corresponding position on the front face on the [rack](../block/rack.md)). To operate, the server has to be placed inside a [rack](../block/rack.md). For more information see the [rack](../block/rack.md) entry.
|
||||
Servers are a form of higher tier [computer](../general/computer.md). They can be configured by holding them in the hand and using them - like opening a backpack or Ender pouch, for example. Servers can also be configured after having been installed into a [rack](../block/rack.md) by activating them (aiming at the corresponding position on the front face on the [rack](../block/rack.md)). To operate, the server has to be placed inside a [rack](../block/rack.md). For more information see the [rack](../block/rack.md) entry.
|
||||
|
||||
The tier 1 server is capable of taking the following components:
|
||||
- 1x tier 2 [CPU](cpu2.md)
|
||||
|
@ -0,0 +1 @@
|
||||
os.execute(install.from .. "/bin/opl-flash.lua")
|
@ -142,25 +142,25 @@ local term = require "term"
|
||||
local args, options = shell.parse(...)
|
||||
|
||||
if options.h or options.help then
|
||||
print("opl-flash [-hqr] [--label=EEPROMLabel]")
|
||||
print(" --label= Set specified label for the EEPROM")
|
||||
print(" -q --quiet Do not output anything, and don't ask if sure")
|
||||
print(" -r --reboot Reboot after installing")
|
||||
print(" -h --help Display this help")
|
||||
return
|
||||
print("opl-flash [-hqr] [--label=EEPROMLabel]")
|
||||
print(" --label= Set specified label for the EEPROM")
|
||||
print(" -q --quiet Do not output anything, and don't ask if sure")
|
||||
print(" -r --reboot Reboot after installing")
|
||||
print(" -h --help Display this help")
|
||||
return
|
||||
end
|
||||
|
||||
local say = not (options.q or options.quiet) and print or function()end
|
||||
say ("Do you really want to flash openloader to EEPROM("..tostring(#eeprom).." bytes)[Y/n]")
|
||||
|
||||
if options.q or options.quiet or io.read():lower() == "y" then
|
||||
say("Flashing... Do not reboot now!")
|
||||
component.eeprom.set(eeprom)
|
||||
component.eeprom.setLabel((type(options.label) == "string" and options.label) or version)
|
||||
if options.r or options.reboot then
|
||||
computer.shutdown(true)
|
||||
else
|
||||
say("Done. you can reboot now")
|
||||
end
|
||||
if options.q or options.quiet or ((io.read() or "n").."y"):match("^%s*[Yy]") then
|
||||
say("Flashing... Do not reboot now!")
|
||||
component.eeprom.set(eeprom)
|
||||
component.eeprom.setLabel((type(options.label) == "string" and options.label) or version)
|
||||
if options.r or options.reboot then
|
||||
computer.shutdown(true)
|
||||
else
|
||||
say("Done. you can reboot now")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -158,10 +158,13 @@ function buffer:read(...)
|
||||
if type(format) == "number" then
|
||||
return readBytesOrChars(format)
|
||||
else
|
||||
if type(format) ~= "string" or unicode.sub(format, 1, 1) ~= "*" then
|
||||
local first_char_index = 1
|
||||
if type(format) ~= "string" then
|
||||
error("bad argument #" .. n .. " (invalid option)")
|
||||
elseif unicode.sub(format, 1, 1) == "*" then
|
||||
first_char_index = 2
|
||||
end
|
||||
format = unicode.sub(format, 2, 2)
|
||||
format = unicode.sub(format, first_char_index, first_char_index)
|
||||
if format == "n" then
|
||||
return require("tools/advanced-buffering").readNumber(self, readChunk)
|
||||
elseif format == "l" then
|
||||
|
@ -52,7 +52,8 @@ function process.load(path, env, init, name)
|
||||
io.stderr:write(path .. ": is a directory\n")
|
||||
return 126
|
||||
end
|
||||
io.stderr:write(path .. ": " .. reason .. "\n")
|
||||
local handler = require("tools/programLocations")
|
||||
handler.reportNotFound(path, reason)
|
||||
return 127
|
||||
end
|
||||
os.setenv("_", program)
|
||||
|
@ -0,0 +1,24 @@
|
||||
local computer = require("computer")
|
||||
local lib = {}
|
||||
|
||||
function lib.locate(path)
|
||||
for _,lookup in ipairs(computer.getProgramLocations()) do
|
||||
if lookup[1] == path then
|
||||
return lookup[2]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function lib.reportNotFound(path, reason)
|
||||
checkArg(1, path, "string")
|
||||
local loot = lib.locate(path)
|
||||
if loot then
|
||||
io.stderr:write("The program '" .. path .. "' is currently not installed. To install it:\n" ..
|
||||
"1. Craft the '" .. loot .. "' floppy disk and insert it into this computer.\n" ..
|
||||
"2. Run `install " .. loot .. "`")
|
||||
elseif type(reason) == "string" then
|
||||
io.stderr:write(path .. ": " .. reason .. "\n")
|
||||
end
|
||||
end
|
||||
|
||||
return lib
|
@ -83,8 +83,6 @@ object ModOpenComputers extends ModProxy {
|
||||
api.IMC.registerProgramDiskLabel("md5sum", "data", "Lua 5.2", "Lua 5.3", "LuaJ")
|
||||
api.IMC.registerProgramDiskLabel("sha256sum", "data", "Lua 5.2", "Lua 5.3", "LuaJ")
|
||||
api.IMC.registerProgramDiskLabel("refuel", "generator", "Lua 5.2", "Lua 5.3", "LuaJ")
|
||||
api.IMC.registerProgramDiskLabel("pastebin", "internet", "Lua 5.2", "Lua 5.3", "LuaJ")
|
||||
api.IMC.registerProgramDiskLabel("wget", "internet", "Lua 5.2", "Lua 5.3", "LuaJ")
|
||||
api.IMC.registerProgramDiskLabel("irc", "irc", "Lua 5.2", "Lua 5.3", "LuaJ")
|
||||
api.IMC.registerProgramDiskLabel("maze", "maze", "Lua 5.2", "Lua 5.3", "LuaJ")
|
||||
api.IMC.registerProgramDiskLabel("arp", "network", "Lua 5.2", "Lua 5.3", "LuaJ")
|
||||
|
Loading…
x
Reference in New Issue
Block a user