Lua Workshop

Lua Workshop

A hands-on workshop to help you learn Lua programming language syntax and semantics

Shakthi Kannan

@shakthimaan

Lua Workshop

Submitted Jul 4, 2019

Lua is a simple, powerful, efficient, embeddable scripting language. It is widely used in the industry and is a leading scripting language for C projects. This workshop introduces the participants to the Lua programming language, its syntax and semantics. Lab exercises help in quickly understanding the language constructs. We will then explore three Lua use cases. Firstly, the Wireshark protocol analyzer is useful for troubleshooting network problems, and analyzing communication protocols. Using the Wireshark Lua API one can implement packet dissectors for custom protocols. Secondly, the Nginx web server functionality can be scripted using Lua, and we will demonstrate the same. Finally, Awesome is a tiling window manager written in C and can be extended using Lua. We shall learn how to configure and customize the window manager.

The workshop is useful for both developers and operations engineers. If you are working on a C project that you would like to extend and provide a scripting interface, then Lua is a preferred choice. The gaming industry uses Lua extensively for scripting, and game developers will benefit from learning the same. A system administrator or network operations person who would like to troubleshoot networks and analyze protocols will find the Wireshark Lua plugin interface very useful. As a programming language enthusiast, you will add another simple, yet powerful scripting language to your knowledge. At the end of the workshop, you will have learnt the Lua programming language, and understood its use cases with examples. More about Lua can be found at its web site.

https://www.lua.org

Outline

Lua

We will begin with the Lua programming language syntax and semantics. Hands-on exercises will be provided to the participants to assist in learning the language.

  • Environment
  • Syntax
  • Variables
  • Data Types
  • Operators
  • Loops
  • Conditionals
  • Functions
  • Strings
  • Arrays
  • Iterators
  • Tables
  • Modules
  • Coroutines
  • Files
  • Error handling

Use Cases

We will be going through three use cases for Lua.

  • Wireshark Lua plugin

Wireshark (https://www.wireshark.org/) is a Free (Libre) and Open Source protocol analyzer used for troubleshooting networks, and analysis of communication protocols. The Lua programming language support has been included in Wireshark for scripting, prototyping and packet dissection. We will learn how to use Lua to do protocol dissection on packet captures with Wireshark.

  • Lua with Nginx

The OpenResty (http://openresty.org/en/) release has Lua support with Nginx that allows you to extend the C functionality of the web server, and also do scripting. We shall demonstrate few examples of the same.

  • Awesome window manager and Lua

The Awesome (https://awesomewm.org/) is a tiling window manager that can boost your productivity. It is small, fast and highly extensible using the Lua programming language, and we will learn how to configure the same.

Requirements

You need to have Lua installed on your laptop. If you are on any GNU/Linux distribution, you can the package manager to install Lua. For the use case examples, you need to install Wireshark (GUI), awesome window manager and OpenResty (http://openresty.org/).

If you are on any other operating system, use a Virtual Machine to run any *nix distribution, and install the above mentioned packages. The official Wireshark downloads are available at https://www.wireshark.org/#download.

Familiarity with any programming language is good to get started with Lua.

Speaker bio

Shakthi Kannan is a Free Software enthusiast who blogs at shakthimaan.com. He is an avid promoter of Free/Libre and Open Source Software, and has been organizing technical workshops in India for more than a decade. He holds a Masters degree in Information Technology from Rochester Institute of Technology.

Comments

{{ gettext('Login to leave a comment') }}

{{ gettext('Post a comment…') }}
{{ gettext('New comment') }}
{{ formTitle }}

{{ errorMsg }}

{{ gettext('No comments posted yet') }}

Hosted by

We care about site reliability, cloud costs, security and data privacy