Support de cours Lua Programming Language, tutoriel & guide de travaux pratiques LUA en pdf.
Lua is … embedded in a fair share of applications
• Wireshark
• Nmap
• Snort
• Cisco SM
• Barracuda Web Server
• Chipmunk AV controller
• Oliveh printers
and many many others
Why Lua ?
• Embeddability
• Portability
• Simplicity
• Small Size
• Quite Efficient
• Free Open-‐Source Sooware
Embeddability
• Provided as a C library
– stand-‐alone interpreter is a client
• Simple API
– simple types
– low-‐level opera9ons
– stack model
• Embedded in C/C++, Java, Fortran, C#, Perl, Ruby, Ada, etc.
– language designed with embedding in mind – bi-‐direc9onal
• host calls Lua and Lua calls host
• most other scrip9ng languages focus only on calling external code
Portability
• Runs on most machines we ever heard of
– Unix, Mac, Windows, Windows CE, Symbian, Palm, Xbox, PS2, PS3, PSP, etc.
– embedded hardware
• WriCen in ANSI C / ANSI C++
– avoids #ifdefs
– avoids dark corners of the standard
– development for a single and very well documented plarorm:
ANSI C
• Lua has “two parts”: core and library
– core moving towards a free-‐standing implementa9on
• no direct dependencies on the OS
Simplicity
• Just one data structure: tables
– associa9ve arrays
– t.x for t[« x »] (sugar syntax)
– all efforts to simplicity and performance
• Complete manual with 100 pages
– core, libraries (standard, auxiliary) and API
• Paradigm: mechanisms instead of policies • Non-‐in9mida9ng syntax
– For non-‐programmers users like engineering, geologists, mathema9cians, etc
………