How to Call C++ from Lua
In the previous three chapters, we focused on learning how to call Lua from C++. In this chapter, we will start to learn how to call C++ from Lua. This is important for your applications because although Lua scripts can extend your C++ applications, they can also benefit from the functions provided by your native C++ code.
This also means we will learn more concepts and piece different things together to make it work. Although the chapters are laid out in a way that they extend the previous chapter in a seamless flow, you may need a different pace to absorb the new concepts. Do read the sections more times if you need practice with coding.
We will cover the following topics:
- How to register C++ functions
- How to override Lua library functions
- How to register C++ modules