Lua - Miscellaneous operators


Miscellaneous operators supported by Lua Language include concatenation and length.

Operator Description Example
.. Concatenates two strings. a..b where a is "Hello " and b is "World", will return "Hello World".
# A unary operator that returns the length of the a string or a table. #"Hello" will return 5


Try the following example to understand the miscellaneous operators available in the Lua programming language −

a = "Hello "
b = "World"

print("Concatenation of string a with b is ", a..b )

print("Length of b is ",#b )

print("Length of b is ",#"Test" )

When you build and execute the above program, it produces the following result −

Concatenation of string a with b is 	Hello World
Length of b is 	5
Length of b is 	4