Lua Programming/print

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Usage[edit | edit source]

print ( [ LIST ] )[edit | edit source]

The print function is variadic and is used to produce simple standardized output. A comma separated list of items for output is provided in the argument list.

Examples[edit | edit source]

print ("Hello")

The newline is automatic[edit | edit source]

In lua, the print function automatically outputs a newline, so there is no need to embed a newlineescape sequence into the output string.

Supression of the automatic newline[edit | edit source]

The write command provides the same functionality as the print function, but does not automatically output the newline character.