- Lua Tutorial
- Lua - Home
- Lua Basics Tutorial
- Lua - Overview
- Lua - Environment
- Lua - Basic Syntax
- Lua - Variables
- Lua - Data Types
- Lua - Operators
- Lua - Loops
- Lua - Decision Making
- Lua - Functions
- Lua - Strings
- Lua - Arrays
- Lua - Iterators
- Lua - Tables
- Lua - Modules
- Lua - Metatables
- Lua - Coroutines
- Lua - File I/O
- Lua - Error Handling
- Lua Advanced
- Lua - Debugging
- Lua - Garbage Collection
- Lua - Object Oriented
- Lua - Web Programming
- Lua - Database Access
- Lua - Game Programing
- Lua Useful Resources
- Lua - Quick Guide
- Lua - Useful Resources
- Lua - Discussion
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". |
# | An unary operator that return the length of the a string or a table. | #"Hello" will return 5 |
Example
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
lua_operators.htm
Advertisements