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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.