Take a tour !

A quick overview of Luart

Some computation

We can now use Luart to compute computations the same way as standard Lua :

As you can see, Lua is capable of handling a range of mathematical operations, thanks to its math module and bits operators.

Iterables

Luart offers iterable values, which can be iterated over. The term iterable refers to values that contain elements that can be iterated over one by one with the global each() function :

In this example, you may have guessed that strings in Luart are iterable character by character. Nonetheless, Luart provides string properties that are not limited to this.

UTF8 strings

Since Lua 5.3 a new module utf8 is available to help developers with UTF8 encoded strings. But this greatly complicates the use of UTF8 strings, as it uses specific functions. A kind of overlay over strings. Not very friendly : in other modern programming languages, strings are containers for characters and support natively multibytes encodings.

Luart have dedicated UTF8 string functions, to preserve standard Lua string compatibility :

Here, we defined a summer_infrench variable containing the string "été" (it's the word "summer" in french !). This string contains 3 characters but the result of the string.len() operator is 5 ! It's because Lua's string.len() function always returns the number of bytes that a string occupies in memory, not the character length. Luart provides a specfic length function for UTF8 strings string.ulen() (note the u prefix, that stands for UTF8). Let's now check that the UTF8 character string "été" contains 5 bytes in memory :