LogLib

A library for logging to the screen, which is either the built-in computer screen or a connected monitor of any size.

Contents:

Functions

init()

Initializes LogLib with setting the title in the computer and, if a monitor is present, setting the title in the monitor and redirecting output to the monitor.

function loglib.init(title, version)
    ...
end

Arguments:

Name

Type

Default

Description

title

string

nil

Title that will be displayed at the top of the screen.

version

string

nil

Version that will be displayed at the top of the screen.

Returns: nil

Example:

local loglib = require("loglib")
loglib.init("Test PC", "V1.0")

This would initialize LogLib and would display the text Test PC V1.0 at the top of the screen.

Warning

If a monitor is present, all text ouput will be redirected onto the monitor.

Note

Screen refers to the active output. If no monitor is present, the active output is the computer screen. If a monitor is present, the active output is the monitor.


log()

Loggs a message with a tag and the current in-game time to the screen

function loglib.log(tag, msg)
    ...
end

Arguments:

Name

Type

Default

Description

tag

string

nil

Tag that will be displayed.

msg

string

nil

Message that will be displayed.

Example:

local loglib = require("loglib")
loglib.log("Test", "This is a test message")

This would display the text <5.345> [Test] This is a test message, if we assume the current in-game time is 5.345.

Returns: nil

Important

LogLib has to be initialized when using this function.


Local Functions

Note

Local functions are defined in a local scope and thus can only be used within this program. They mainly server as helper functions for the program itself.

setTitle(title, version)

Sets the title displayed at the top of the screen.

function loglib.setTitle(title, version)
    ...
end

Arguments:

Name

Type

Default

Description

title

string

nil

Title that will be displayed at the top of the screen.

version

string

nil

Version that will be displayed at the top of the screen.

Returns: nil

Example:

local loglib = require("loglib")
loglib.setTitle("Test PC", "V1.0")

This would display the text Test PC V1.0 at the top of the screen.