Function
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)
addEventHandler("onClientResourceStart", resourceRoot, function()
print("console", "Witaj na serwerze!")
print("debug", "Pozycja startowa:", getElementPosition(localPlayer))
if not getElementData(localPlayer, "konto") then
print("errors", "Brak danych konta gracza")
end
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
outputConsolePrints a line in the F8 console. On the server, with no target the line goes to every player.outputServerLogWrites a line to the server log (console and file) without sending it to players.outputDebugStringAdds an entry to the debug log (/debugscript). Levels 1-3 add the script file and line.iprintPrints values throughinspectto the debug console. Several arguments are separated with spaces.