OneCompiler

Printing

Printing

Printing in Lua is very simple, but quite effective. Printing is how you display text, numbers, booleans, and more into the terminal.

How to print in Lua

Printing is a built in function, so you can simply call it:

print()

Like that. If you want to actually print something in it, simply add what you want to print it.

If you want to print text, simply put the string inside of the parentheses.
Example:

print("Hello, World!")

If you want to print a number, simply put the number in the parentheses.
Example:

print(15)

If you want to print a boolean, simply put the boolean in the parentheses.

print(true)

Printing with variables

If you want to print a variable, simply put the variable inside of the parentheses.
Example:

local food = "Steak"
print(food)