Over a million developers have joined DZone.

Lua: Not Your Average Scripting Language

As more people realize the power and ease of using Lua, and industries like IoT and smart machines expand, we believe more companies will be embracing this language.

· IoT Zone

Access the survey results 'State of Industrial Internet Application Development' to learn about latest challenges, trends and opportunities with Industrial IoT, brought to you in partnership with GE Digital.

Lua is not your average scripting language. It is small, fast, portable, and embeddable. These cornerstones of the language make it well-suited in many facets of the software industry, including embedded devices, video games, and even web applications. The language has been embraced by NASA, Adobe, NGINX, and Mozilla — to name a few. As more people realize the power and ease of using Lua, and industries like IoT and smart machines expand, we believe more companies (and individuals) will be embracing this language.

Lua is not a new language. It has been around since the early 1990s and has demonstrated continued growth year after year in various software disciplines. As a small language comprising less than 10,000 lines of C code, Lua is extremely stable and virtually bug-free. Its authors are committed to keeping the language simple and performant, and the language's slow and steady development cycle underscores this commitment.

Lua has many strengths. Among them are its small size and portability. Unzipped, Lua's source files weigh in at a meager 800K. The stand-alone Lua interpreter binary is not quite 250K, and its compiled, static library measures less than 500K. Lua's tiny footprint is particularly ideal for embedded devices, where resources are limited. Also, since the language is written in portable, ANSI C, Lua can run on practically any device that has a C compiler written for it. This means that Lua has a unique place in the up-and-coming Internet of Things (IoT) device industry.

In addition to small size and portability, Lua's embeddability should not be overlooked. By using Lua's C API (Application Programming Interface), developers can extend their static programs with dynamic Lua code. For example, many video games rely on C for its raw speed when it comes to graphics computations, but game logic is easily prototyped, written, and tested with Lua, which requires no recompilation.

Despite its longevity, Lua has a unique place in the modern web development world inside NGINX, one of the world's most popular web servers. OpenResty is a dynamic web platform that "embeds the power of Lua into Nginx HTTP Servers, and one of its biggest users is Cloudflare which depends on Lua's incredible speed as a scripting language.

While Lua is an easy language to learn (its entire reference manual is just 100 printed pages in length), developers might scoff at its small, seemingly primitive standard library, which is a side-effect of Lua's commitment to platform portability. However, this is where the LuaRocks project comes into play. LuaRocks is the de facto package manager for community-contributed Lua modules (a.k.a. libraries) — over 1200 of them to be precise. Modules for everything from working with sockets to filesystem manipulation to web frameworks are available. It's also extremely easy to contribute your own "rocks."

It's easy to see why Lua is growing in both interest and use in the software industry. The language's unique combination of small size, speed, portability, and embeddability make it an ideal candidate for a wide array of applications in embedded devices, the gaming industry, web applications, and beyond.

If you haven't already, sign up to be the first to know when our ActiveLua distribution has been released.

The IoT Zone is brought to you in partnership with GE Digital.  Discover how IoT developers are using Predix to disrupt traditional industrial development models.

Topics:
iot ,lua scripting ,embedded devices ,activelua

Published at DZone with permission of Tom Radcliffe. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}