Console I/O

We can use the io module to perform console I/O. The io.print function prints a string to the console. The io.log function is similar to io.print, but it also prints a newline character at the end and writes to stdout. We can create a logger using the io.logger function, which returns a function that logs messages to the console.

The web based playground does not support console I/O yet, but you can run this code in a local environment to see the output.

io.print("Hello, World!\n") io.log("Hello, Log!") log = io.logger("test") log("Hello, World!")

© 2024 ouzu