print table lua
To print a table in Lua, you can use the print function. Here is an example:
local myTable = {1, 2, 3, 4, 5}
print(myTable)
Explanation:
- In the first line, we create a variable called myTable
and assign it a table with values 1, 2, 3, 4, and 5.
- In the second line, we use the print
function to display the contents of myTable
on the console.
This will output the following result:
table: 0x7f8a8b403e80
The output shows that myTable
is a table and provides its memory address.