Long Comments and Long Strings

Asked

Viewed 91 times

-4

I would like an appropriate explanation of what they are Long Comments and Long Strings, although they may be small resources.

1 answer

2

Long Comments (long comments) are comments using Long Format. Long Strings (long strings) represent strings, but also using Long Format.

Long Format

Long Format (long format) is a format that differentiates between -5.1 and +5.2 versions.

Version 5.1

In this version the format starts with the sequence [[ and ends with the sequence ]] related (the same pairs can repeat themselves in).

Version 5.2

In this version the format receives a lock level. The format only starts if its start is valid. The beginning starts with [ and count the symbols = until you show up ] to finish himself. If there was any character outside = and [ , then the format does not start.

The lock level shall be the amount of assignments (=).

The end format is similar to the beginning, only changes [ for ] and requires the same amount of assignments.

Long Comment

Nothing special about its format, besides that the format should be declared after --.

Long String

The long string format does not interpret the escape (\) , requires an end and has two core actions:

  • Converts the byte sequence 0D 0A (Carriage Return and new line, r n) and the byte 0D (\r) to 0A (\n)

  • Ignore the first line break (0D 0A, 0A or 0D) followed by its beginning

The language interpreter assumes that the bytes of the target code are character codes, so any future problem relates to the encoding of its characters.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.