Kernel Module

This Module provides an interface for other Modules to interact with the Kernel.

Dependencies

Globals

computer

computer.beep (pitch: number)

Lets the computer emit a simple beep sound with the given pitch.

Details
Parameters
Name Type Description

Pitch pitch

number

a multiplier for the pitch adjustment of the beep sound

computer.getEEPROM () → string

Returns the current eeprom contents.

Details
Return Values
Name Type Description

Code code

string

The EEPROM Code as string

computer.getInstance () → ComputerCase

Returns a reference to the computer case in which the current code is running.

Details
Return Values
Name Type Description

Case case

ComputerCase

The computer case this lua runtime is running in

computer.getMemory () → (usage: integer, capacity: integer)

Returns the used memory and memory capacity the computer has.

Details
Return Values
Name Type Description

Usage usage

integer

The memory usage at the current time

Capacity capacity

integer

The memory capacity the computer has

computer.getPCIDevices (type: Object-Class?) → Object[]

This function allows you to get all installed PCI-Devices in a computer of a given type. Have a look at this example to fully understand how it works.

Details
Parameters
Name Type Description

Type type

Object-Class?

Optional type which will be used to filter all PCI-Devices. If not provided, will return all PCI-Devices

Return Values
Name Type Description

Objects objects

Object[]

An array containing instances for each PCI-Device built into the computer

computer.media : FINMediaSubsystem

Field containing a reference to the Media Subsystem.

computer.millis () → integer

Returns the amount of milliseconds passed since the system started.

Details
Return Values
Name Type Description

Millis millis

integer

The amount of real milliseconds sinde the ingame-computer started

computer.panic (error: string)

Crashes the computer with the given error message.

Details
Parameters
Name Type Description

Error error

string

an error message

computer.reset ()

Stops the current code execution immediately and queues the system to restart in the next tick.

computer.setEEPROM (code: string)

Sets the code of the current eeprom. Doesn¬タルt cause a system reset.

Details
Parameters
Name Type Description

Code code

string

The new EEPROM Code as string

computer.stop ()

Stops the current code execution. Basically kills the PC runtime immediately.

filesystem

filesystem.initFileSystem (path: string) → boolean

Trys to mount the system DevDevice to the given location. The DevDevice is special Device holding DeviceNodes for all filesystems added to the system. (like TmpFS and drives). It is unmountable as well as getting mounted a seccond time.

Details
Parameters
Name Type Description

Path path

string

path to the mountpoint were the dev device should get mounted to

Return Values
Name Type Description

Success success

boolean

returns if it was able to mount the DevDevice

filesystem.makeFileSystem (type: string, name: string) → boolean

Trys to create a new file system of the given type with the given name. The created filesystem will be added to the system DevDevice.

Possible Types:
  • tmpfs

    A temporary filesystem only existing at runtime in the memory of your computer. All data will be lost when the system stops.

Details
Parameters
Name Type Description

Type type

string

the type of the new filesystem

Name name

string

the name of the new filesystem you want to create

Return Values
Name Type Description

Success success

boolean

returns true if it was able to create the new filesystem

filesystem.removeFileSystem (name: string) → boolean

Tries to remove the filesystem with the given name from the system DevDevice. All mounts of the device will run invalid.

Details
Parameters
Name Type Description

Name name

string

the name of the new filesystem you want to remove

Return Values
Name Type Description

Success success

boolean

returns true if it was able to remove the new filesystem