ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Shared functions
  3. print

Function

print

Server and clientChat and consoleTrilogy Hub only

Prints text to the chosen console. The first argument is a required category that says where the text goes. The remaining values are converted to text and joined with two spaces.

Syntax

bool print(string category, ...)

Arguments

categorystring
Console category. Server: "server" (server console and log), "console" (in-game console of every player). Client: "console" (main in-game console tab), "debug" (Debug tab), "errors" (Errors tab). Case does not matter.
...any, optional
Values to print (any type, through tostring).

Returns

true on success; false and a warning in the log when the category is missing or does not exist on this side.

Example

addEventHandler("onResourceStart", resourceRoot, function()
    print("server", "Zasób uruchomiony, graczy:", #getElementsByType("player"))
    print("console", "Serwer wczytał nową mapę")
end)

Notes

The category is required. A plain print("text") from standard Lua does not work here: it logs a Bad argument @ 'print' warning and returns false. The debug and errors categories exist only in client scripts, and server only in server scripts.

See also