SKS OCDoc
OpenComputers
Computronics
Minitel

lib/doc.lua

doc.searchers.lib(name^string^): string, string

Tries to find a documentation from a library with name. Returns either a string of documentation, or false and a reason.

doc.docs(topic^string^): boolean

Displays the documentation for topic, returning true, or errors. Also callable as just doc().

doc.format(fdoc^table^): string

returns VT100 formatted documentation from documentation table fdoc

doc.searchers.cdoc(topic^string^): string, string

Searches for documentation labelled as topic in .dict files under /boot/doc/

doc.parsefile(path^string^): table

parses file from path to return a documentation table

lib/download.lua

dl.protos.fget(host^string^, optPort^string^, path^string^, dest^number^): boolean

Downloads path from host (on optPort or 70), printing the directory listing, or saving the file to dest.

dl.protos.http(host^string^, optPort^string^, path^string^, dest^number^, url): boolean

Downloads url to dest via the internet card, if available.

dl.wget(remotePath^string^, dest^string^)

Downloads from remote remotePath to dest

lib/event.lua

event.listen(e^string^, f^function^)

run function f for every occurance of event e

event.pull(t^number^, ...)

return an event, optionally with timeout t and filter ....

event.ignore(e^string^, f^function^)

stop function f running for every occurance of event e

lib/liblz16.lua

lz16.buffer(stream^table^): table

Wrap a stream to read or write LZ16.

lz16.open(fname^string^, mode^string^): table

Open file fname to read or write LZ16-compressed data depending on mode

lib/libmtar.lua

mtar.genHeader(fname^string^, len^number^, version): string

generate a header for file fname when provided with file length len

mtar.iter(stream^table^): function

Given buffer stream, returns an iterator suitable for use with for that returns, for each iteration, the file name, a function to read from the file, and the length of the file.

lib/minitel.lua

net.send(to^string^, port^number^, ldata^string^): boolean

send arbitrary data ldata reliably to host to on port port

net.rsend(to^string^, port^number^, data^string^, block^boolean^): boolean

send a reliable packet to host to on port port with data data, with block set to true to disable blocking

net.genPacketID(): string

generate a random 16-character string, for use in packet IDs

net.flisten(port^number^, listener^function^): function

run function listener on a connection to port

net.open(to^string^, port^number^): buffer

open a socket to host to on port port

net.listen(port^number^): buffer

listen for connections on port port in a blocking manner

net.usend(to^string^, port^number^, data^string^, npID^string^)

send an unreliable packet to host to on port port with data data, optionally with the packet ID npID

lib/netutil.lua

netutil.ping(addr^string^, times^number^, timeout^number^, silent^boolean^): boolean, number, number, number

Request acknowledgment from addr, waiting timeout seconds each try, and try times times. If silent is true, don't print status. Returns true if there was at least one successful ping, the number of successes, the number of failures, and the average round trip time.

netutil.nc(host^string^, port^number^): boolean

Starts an interactive Minitel socket connection to host on port, primarily for remote login. Returns whether the attempt was successful.

netutil.exportfs(path^string^): boolean

Export the directory path over RPC.

netutil.importfs(host^string^, rpath^string^, lpath^string^): boolean

Import filesystem rpath from host and attach it to lpath.

lib/pkgfs.lua

pkgfs.remove(fname^string^): boolean

Removes the package specified by fname from the pkgfs index.

pkgfs.add(fname^string^, comp^boolean^): boolean

Add a package as specified in fname to the pkgfs component. If comp is true, read it as a LZ16-compressed package.

lib/pkgman.lua

pkg.update()

Re-download cached repository indexes.

pkg.get(pkgname^string^, auto^boolean^): boolean

Downloads and mounts a package, identified as pkgname, onto the pkgfs. Setting auto will flag the package as automatically installed; this is used for dependencies.

pkg.remove(pkgname^string^): boolean

Remove the package pkgname from the pkgfs and package directory.

pkg.upgrade(force^boolean^)

Upgrades all packages on the system to the current version stored in the relevant repository. If force is set, re-download all packages.

pkg.list(filter^string^, installed^boolean^)

Print a list of available packages matching filter, optionally filtering to only installed packages if installed is set.

pkg.delRepo(name^string^): boolean

Removes a repository from the list of repositories.

pkg.getMeta(pkgname^string^): table

Returns the metadata for a the package specified in pkgname.

lib/rc.lua

rc.start(name^string^, ...): boolean, string

Stops service name, supplying ... to the stop function. Returns false and a reason if this fails.

rc.load(name^string^, force^boolean^): table

Attempts to load service name, and if force is true, replaces the current instance.

rc.stop(name^string^, ...): boolean, string

Stops service name, supplying ... to the stop function. Returns false and a reason if this fails.

rc.disable(name^string^)

Disables service name being started on startup.

rc.enable(name^string^)

Enables service name being started on startup.

rc.restart(name^string^)

Restarts service name using rc.stop and rc.start.

lib/rpc.lua

rpc.allow(fn^string^, host^string^)

Enable the allow list for function fname and add host to it.

rpc.register(name^string^, fn^function^)

Registers a function to be exported by the RPC library.

rpc.deny(fn^string^, host^string^)

Enable the deny list for function fname and add host to it.

rpc.unregister(name^string^)

Removes a function from the RPC function registry, clearing any ACL rules.

rpc.call(hostname^string^, fn^string^, ...): boolean

Calls exported function fn on host hostname, with parameters ..., returning whatever the function returns, or false.

rpc.proxy(hostname^string^, filter^string^): table

Returns a component.proxy()-like table from the functions on hostname with names matching filter.

lib/serialization.lua

serial.unserialize(data^string^)

return data, but unserialized

serial.serialize(value^boolean^, af): string

serialize value into a string. If af is true, allow functions. This breaks unserialization.

lib/shutil.lua

shutil.ps()

Prints the processes running on the system.

shutil.cat(...^string^)

Outputs the contents of files specified in ... to the standard output.

shutil.free()

Displays used and free memory.

shutil.mount(addr^string^, path^string^): boolean, string

Mounts filesystem component with address addr to path in the filesystem.

shutil.df()

Prints free disk space.

shutil.ls(...^string^)

Prints contents of directories specified as ....

shutil.import(lib^string^): boolean

Imports the functions from library lib into the shell environment.

shutil.unimport(lib^string^): boolean

Removes the functions from lib from the shell environment.

lib/vtansi.lua

vtansi.vtemu(gpu^table^, bn^number^): function

takes GPU component proxy gpu and returns a function to write to it in a manner like an ANSI terminal, either allocating a new buffer or using bn.

vtansi.vtsession(gpua^string^, scra^string^, bn^number^): function, function, function

creates a process to handle the GPU and screen address combination gpua/scra, optionally using buffer number bn specifically. Returns read, write and "close" functions.

module/buffer.lua

buffer.new(mode^string^, stream^table^): table

create a new buffer in mode mode backed by stream object stream

module/devfs.lua

devfs.register(fname^string^, fopen^function^)

Register a new devfs node with the name fname that will run the function fopen when opened. This function should return a function for read, a function for write, function for close, and optionally, a function for seek, in that order.

module/fs.lua

fs.address(path^string^): string

Returns the address of the filesystem at a given path, if applicable; do not expect a sensical response

fs.rename(from^string^, to^string^): boolean

Moves file from to to

fs.type(path^string^): string

Returns the component type of the filesystem at a given path, if applicable

fs.resolve(path^string^): string, string

Resolves path to a specific filesystem mount and path

fs.umount(path^string^)

Unmounts filesystem from path.

fs.mounts(): table

Returns a table containing the mount points of all mounted filesystems

fs.copy(from^string^, to^string^): boolean

copies a file from from to to

fs.open(path^string^, mode^string^): table

Opens file path with mode mode, returning a file object.

fs.segments(path^string^): table

Splits path on each /

fs.mount(path^string^, proxy^table^): boolean

Mounts the filesystem proxy to the mount point path if it is a directory. BYO proxy.

module/io.lua

print(...)

Writes each argument to the default output stream, separated by space.

io.output(fd^table^): table

Sets the default output stream to fd if provided, either as a buffer as a path. Returns the default output stream.

io.read(...)

Reads from the default input stream.

io.input(fd^table^): table

Sets the default input stream to fd if provided, either as a buffer as a path. Returns the default input stream.

io.write(...)

Writes its arguments to the default output stream.

io.open(path^string^, mode^string^): table

Open file path in mode. Returns a buffer object.

module/loadfile.lua

reload(f^string^): table

Reloads library f from disk into memory.

loadfile(p^string^): function

reads file p and returns a function if possible

require(f^string^, force^boolean^): table

searches for a library with name f and returns what the library returns, if possible. if force is set, loads the library even if it is cached

runfile(p^string^, ...)

runs file p with arbitrary arguments in the current thread

module/osutil.lua

os.chdir(p^string^): boolean, string

changes the current working directory of the calling process to the directory specified in p, returning true or false, error

module/sched.lua

os.taskInfo(pid^number^): table

returns info on process pid as a table with name and parent values

os.pid(): number

returns the current process' PID

os.getenv(k)

gets a process' k environment variable

os.sched()

the actual scheduler function

os.spawn(f^function^, n^string^): number

creates a process from function f with name n

os.setenv(k, v)

set's the current process' environment variable k to v, which is passed to children

os.tasks(): table

returns a table of process IDs

os.kill(pid^number^)

removes process pid from the task list

module/syslog.lua

syslog(msg^string^, level^number^, service^string^)

Output msg to the system log, with severity level, from service.

© ShadowKat Studios
The software used to generate this page is licensed under the Mozilla Public License version 2 and can be found here