The Hacker's Language in Action: #3 Strings

in #software7 years ago

Strings in Lua are sequences of bytes... Lua is eight-bit clean and its strings can contain bytes with any numeric code, including embedded zeros.

Roberto Ierusalimschy.

portada_lua.png

Basics: a change, length operator and concatenation operator

lua_strings_1.png

Escape sequences in Lua

C-like Escape SequenceCharacter
\abell
\bbackspace
\fform feed
\nnewline
\rcarriage return
\thorizontal tab
\vvertical tab
\\backslash
\"double quote
\'single quote

lua_strings_2.png

Corecions

lua_strings_3.png

The String Library

lua_strings_4.png

Format and More:

lua_strings_5.png

Unicode

lua_strings_6.png

References

  • Roberto Ierusalimschy, Programming in Lua, Fourth Edition.
  • lua.org

Previous post

Sort:  

About Hacking, Is Lua better that Python?