How to declare string strings?

0

Moon is written in C logo shares the American Standard Code for ASCII Information Exchange

Accepts array key declaration with accent:

rafael = {}
rafael["é"]="eu"
print(rafael["é"])

--saída:     eu

But how to do string declaration with string?

é="eu"      -- é possível ?
    
asked by anonymous 16.10.2017 / 03:37

1 answer

1

Terminology . In your example é="eu" , you would call é of an identifier or name .

Responding . A Lua code is divided into: grammar and syntax. Syntax depends on grammar (as the only lexical object on the Moon). In the Moon grammar you can only enter the is character within comments and string strings, because your productions do not care for all characters (only delimiters, if any).

Other than that, it is not possible to enter the is character and responded. Moon has nothing to do with C.

Lexical definition of a Lua name (based on ECMA-357 2º):

Name ::

  • NameRepeat but no keywords

NameRepeat ::

  • NameStart
  • NameRepeat NameRepeat

NameStart ::

  • Any Latin letter (A-Z or a-z) in ASCII
  • _

NamePart ::

  • NameStart
  • Any ASCII digit

That is, an identifier consists of normal ASCII and / or (traces) letters and optionally continues with digits. That's what the manual says.

    
21.10.2017 / 02:20