Embedding Lua

So far, we have been using Lua as a standalone language. We did this by using the Lua interpreter, which is the lua52 program we renamed lua in Chapter 1, Introduction to Lua. The Lua interpreter itself is written in C. In this chapter, we will explore some of the same methods used to create the interpreter.

Lua as a language was designed with C interoperability in mind. You can use Lua as a standalone language or as an embedded scripting language. Many games and other applications utilize Lua as a scripting language—we will see some examples of this in the next chapter.

In this chapter, we're going to focus on some of the common tasks involved in embedding Lua into any C or C++ application. While we are only focusing on the ...

Get Lua Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.