How to Call Lua from C++
In this chapter, we will implement a C++ utility class to execute Lua scripts. This serves two purposes. First, by doing this, you will learn in detail how to integrate the Lua library and call Lua code from C++. Second, you will have a Lua wrapper class ready to use. This helps in hiding all the details. We will start with a basic Lua executor and then we will gradually add more features to it as we progress. You will learn about the following:
- Implementing a Lua executor
- Executing a Lua file
- Executing a Lua script
- Understanding the Lua stack
- Operating on global variables
- Calling Lua functions