domingo, 14 de junho de 2009

Multi-line Comments in Lua

This is a short tip, how to make multi-lines comments in Lua programming language. Why? Because documentation not have examples of this (see the last paragraph of 2.1 section ).

The multi-lines comments begin with "--[[" (double hyphen, double square brackets) and end with "]]" (double square brackets) .
-- this program is a simple test, and i'm a single line comment

print("this is normal line")

--[[
function opencb(reply)
for k, v in pairs(reply) do
print(k, v)
end
end
]]

print("the book is on the table")



A good beginner material is a Free Spirit Magazine (Espírito livre, in portiguese), in theirs first 3 editions have articles about Lua.

The double brackets ( [[ ]] ) is used too for set long strings blocs to a variable, see the example code.



Today is this. Good week!

0 comentários:

Postar um comentário